+ 1
what the wrong with this code please
Hey 20.2 practice ( club bouncer code ) i get this question : write a program to control entrance to a club , only people who are 18 or older are allowed to inter the club . your program takes the age and the name of the person if they are allowed to inter the club . and "sorry" if they are younger than the allowed age i writed this code : age= int(input()) name = int(input()) if age = 18: print("welcome" "name") else: print("sorry") i know that is wrong in the code but i need help for understand wher
15 Antworten
+ 9
Raoof Zakarna
There should be space after welcome and + instead of comma (,)
And also w and s is in caps
age=int(input())
name= input()
if age >=18:
print("Welcome " + name)
else:
print("Sorry")
+ 4
Thank u very much :)
i understand now and i fix it ,
thank u and i comming shure again with another question 🤲
+ 2
Raoof Zakarna
age= int(input()) # integer
name = input() # string
if age >= 18: #greater than or equal to
print("welcome",name) # indentation
else:
print("sorry") # indentation
# There was also an error in your print statement. You had your variable as a string.
# If you were trying to use string format in your print(), then try this:
print(f"{name} is {age} years old")
+ 2
Raoof Zakarna
Indentation -> rientro
Very important in python
Look at how all your code lines start, and how the code lines in the example start
+ 1
Hello, for one you are taking name as an integer. Second you need to see if they are <= 18 years of age.
+ 1
Hello, Raoof Zakarna
here is the code, try this :-
name=input ()
age=int(input())
if age>=18:
print ("WELCOME,"+name,"\n\nyou are allowed to enter the club")
else:
print ("SORRY,"+name,"\n\nyou are not allowed to enter the club ")
0
age = int(input())
name = input()
# your code goes here
if age>= 18:
print("Welcome " + name)
else:
print("Sorry")
0
age = int(input())
name = input()
# your code goes here
if age>=18:
print("Welcome"+' '+name)
else:
print("Sorry")
- 1
Raoof Zakarna
If you know what is wrong then you should also know where is wrong.
- 1
age= int(input())
name = int(input())
if age = 18:
print("welcome" + name)
else:
print("sorry")
This program run succesfully guarented
- 1
age=int(input())
name=input()
if age>=18:
print("welcome " + name)
else:
print("sorry")
- 2
if i know where is the wrong i would not ask here :)
- 2
age=int(input())
name= input()
if age >=18:
print("welcome",name)
else:
print("sorry")
what about it where is the wrong ?
- 2
name=input()
age=int(input())
print('Name: ',name, ' age: ',age)
if(age>=18):
print('Welcome ',name)
else:
print('Sorry ',name)