Write a program to control entrance to a club. Only people who are 18 or older are allowed to enter the club. Your program take | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Write a program to control entrance to a club. Only people who are 18 or older are allowed to enter the club. Your program take

the age of the person who tries to enter, and outputs "Allowed" if they are allowed to enter the club, and "Sorry" if they are younger than the allowed age. Sample Input 24 Sample Output Allowed

30th Jan 2022, 8:22 PM
Raj Ratan Gautam
Raj Ratan Gautam - avatar
7 Answers
+ 5
age = int(input()) name = input() # your code goes here if age >= 18 : print("Welcome " + name) else : print("Sorry")
19th Sep 2022, 11:01 AM
shubhangi Mahadev Metkari
+ 1
print("Allowed"if int(input())>17 else"Sorry")
30th Jan 2022, 8:36 PM
Mario Paes
Mario Paes - avatar
+ 1
age = int(input()) if age >= 18 : print("Allowed") else : print("Sorry") This is the answer.. Dont Forget to space if statement
5th Feb 2023, 12:21 AM
A L O N E__ツ_
A L O N E__ツ_ - avatar
+ 1
age=int(input()) #your code goes here if age>18: #if age is greater than or equal to 18 then allowed print("Allowed") #*note*:don't forget phyton is case sensitive language.you should define upper_chars variable inside the function. else: #otherwise say sorry print("Sorry")
31st Mar 2023, 5:46 PM
Asma Sulthana
Asma Sulthana - avatar
+ 1
Bro I tried all of the above and it doesn't work
23rd Sep 2023, 3:41 AM
Younis Yousef
Younis Yousef - avatar
0
age = int(input()) if age >= 18: print("Allowed") else: print("sorry")
8th Apr 2022, 7:31 AM
Ashwini Bhavsar
- 2
I dont know but i know there is need to use else i think this will help you age = 16 only = 18 if (age < only) print("Allowed") else { print("Not allowed") } its just example so dont dislike Edit:output is Not allowed
30th Jan 2022, 8:35 PM
Beary
Beary - avatar