0

nested if else statement

i need more method solve ? # ASK USER NAME + AGE # IF USER NAME START WITH 'A','a' & AGE IS ABOVE 10 #PRINT YOU CAN WATCH THIS MOVIE #ANOTHER YOU CANT WATCH THIS MOVIE i try this my code =============== user_name =input("Enter your name :--") user_age=int(input("ENTER YOUR AGE:--")) #nested if -else use if user_age >10 and (user_name[0] == 'a' or user_name[0] == 'A'): print("you watch this movie") else: print("you cant watch this movie")

21st Jul 2019, 1:05 PM
Naeem Kathawala
Naeem Kathawala - avatar
1 Odpowiedź
+ 3
name=input("enter name:").lower() age=int(input("enter age:")) if age > 10 and name.startswith("a"): print("watch movie") else: print("dont watch movie")
21st Jul 2019, 1:17 PM
Steven M
Steven M - avatar