If else statements code coach | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

If else statements code coach

I think I have the code right and the answer isn't correctly programmed because it keeps saying that the code is wrong. I hate to skip any lvl in code coach so that's why i hope someone can clarify this for me: 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 My answer: age = int(input()) if age >= 18: print("Allowed") else: print("Sorry") EDIT: Sorry everyone for the noob question, i see the mistake. it should be: age = int(input()) if age>= 18: print ("Allowed") else: print ("Sorry")

20th Jan 2022, 2:43 PM
Said El Kacimi
3 Answers
+ 3
Else part is idented in if part. Take it out..
20th Jan 2022, 2:47 PM
Jayakrishna 🇮🇳
+ 2
Thank you for your time and answer.
20th Jan 2022, 2:50 PM
Said El Kacimi
0
You're welcome,.
20th Jan 2022, 2:51 PM
Jayakrishna 🇮🇳