lundi 10 février 2020

No output from if statements in some cases

Create a program that asks the user for an age. It tells them their grade (9, 10, 11 or 12) based on their response

When I type in 16, I don't get an output, but when I type in 14 or 15 I get the correct output.

age = (int(input("How old are you?")))


if (age == 14 or age ==15):
    print ("you are in grade 9")

if (age == 15):
    print("or")

    if (age == 15 or age == 16):
        print ("you are in grade 10")

        if (age == 16):
            print("or")

            if (age == 16 or age == 17):
                print ("you are in grade 11")

                if (age == 17):
                    print ("or")

                    if (age == 17 or age == 18):
                        print ("you are in grade 12")

Aucun commentaire:

Enregistrer un commentaire