[Solved] difficulty figuring out what is wrong in my code [closed]


Edit: I didn’t catch what the other two answers said about how you’ve changed Class so that it will never equal 1, 2, 3.

changing your if clauses to

if Class == "1.txt":
    #code
elif Class == "2.txt":
    #code
elif Class == "3.txt":
    #code
else:
    #code to deal with Class not being what you think it should be.
    # perhaps something like
    raise RuntimeError("Class is {}.\n".format(Class))

should fix the problem. I think you should change the second and third if statements to elif. There’s no point in having the interpreter check all three when only one of them will apply.

solved difficulty figuring out what is wrong in my code [closed]