dimanche 21 novembre 2021

Is there something wrong with my if-statement or dictionary?

Every time I write down a grade in the input it takes me to the else and says nocheck. I don't understand why it won't go through the (if question in grade) and continue to write check

courses = {"Biology": 100, "English": 100, "Math": 100}
grade = {"A": 20, "C": 15, "E": 10, "F": 0}

print("Type your grade A,C,E or F")
for i in courses:
    question = input("What grade do you have in " + i + ":").lower()
    if question in grade:
        print("check")
    else:
        print("nocheck")

the values are for scores later when the code works

Aucun commentaire:

Enregistrer un commentaire