5 Answers
New AnswerCoz the input stmt is not inside if or else ,so whatever be the condition , it outputs "Welcome "... You can try this : age =int(input()) if age>=18 : name=input("Welcome") print(name) else : print ("Sorry")
"Welcome" is a text displayed when the input dialogue pops up (you cannot see this on sololearn, but you will notice the difference whe you run it locally on your pc). It is NOT parte if the value of name
Because 18 is the age required or that satisfy condition to not accept person less than 18 years old.
age =int( input()) if age>=18: name =input ("Welcome") print(name) else : print ("Sorry") You can try it. I think it will helps.
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message