if and else in Python,if age is true grade is false,this program print is wrong

You are leaving open the possibility that age >= 8 but grade < 3 in which you have no control flow to handle. You can correct this succinctly with an and statement

age = float(raw_input("Enter your age: "))
grade = int(raw_input("Enter your grade: "))
if age >= 8 and grade >= 3:
    print "You can play this game."
    print "Sorry, you can't play the game."

Browse More Popular Posts

Leave a Comment