+ 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

8th Oct 2021, 7:53 AM
Raoof Zakarna
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")
8th Oct 2021, 9:52 AM
A͢J
A͢J - avatar
+ 4
Thank u very much :) i understand now and i fix it , thank u and i comming shure again with another question 🤲
8th Oct 2021, 9:58 AM
Raoof Zakarna
+ 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")
8th Oct 2021, 9:37 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 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
8th Oct 2021, 9:52 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 1
Hello, for one you are taking name as an integer. Second you need to see if they are <= 18 years of age.
8th Oct 2021, 8:03 AM
Jibraeel Abdelwahhab
Jibraeel Abdelwahhab - avatar
+ 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 ")
9th Oct 2021, 8:37 AM
Tousif HR
0
age = int(input()) name = input() # your code goes here if age>= 18: print("Welcome " + name) else: print("Sorry")
15th Nov 2022, 11:35 AM
Pooja Patel
Pooja Patel - avatar
0
age = int(input()) name = input() # your code goes here if age>=18: print("Welcome"+' '+name) else: print("Sorry")
30th Dec 2022, 5:34 AM
Komal Liladhar Patil
- 1
Raoof Zakarna If you know what is wrong then you should also know where is wrong.
8th Oct 2021, 8:57 AM
A͢J
A͢J - avatar
- 1
age= int(input()) name = int(input()) if age = 18: print("welcome" + name) else: print("sorry") This program run succesfully guarented
6th Dec 2021, 6:42 PM
Abhishek Gosavi
Abhishek Gosavi - avatar
- 1
age=int(input()) name=input() if age>=18: print("welcome " + name) else: print("sorry")
21st Apr 2022, 9:46 AM
Mark Namirengo
- 2
if i know where is the wrong i would not ask here :)
8th Oct 2021, 9:06 AM
Raoof Zakarna
- 2
age=int(input()) name= input() if age >=18: print("welcome",name) else: print("sorry") what about it where is the wrong ?
8th Oct 2021, 9:49 AM
Raoof Zakarna
- 2
name=input() age=int(input()) print('Name: ',name, ' age: ',age) if(age>=18): print('Welcome ',name) else: print('Sorry ',name)
21st Dec 2021, 2:10 PM
SANVIKA