- 2

Can you help me on Else Statement?

Write a program to control entrance to a club. Only people who are 18 or older are allowed to enter the club. Your program takes 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 Here is my attempt: age = int(input()) if age == 24: print("Sorry") else: print("Allowed")

18th Nov 2021, 8:56 AM
Shah Johan
2 Antworten
+ 7
Shah Johan , you have not really started with learning in the tutorials. instead of doing so, you frequently post your problems and ask the community to help you. the majority of your posts starts with: ".., can you help me with ..." this is not how sololearn works. we are a self-learner platform, so please put some more effort in your learning process, instead of asking and picking up informations from the community. if you wanted to learn coding seriously, your way will not be successful.
18th Nov 2021, 10:28 AM
Lothar
Lothar - avatar
+ 6
18 or older are allowed so, if age>=18: print("Allowed") else: print("Sorry")
18th Nov 2021, 9:02 AM
Azhagesanヾ(✿)
Azhagesanヾ(✿) - avatar