def checkclas(x):
while x == "A" or "B" or "C" is not True:
x = input("You have to choose one of the three classes: ").upper()
return x
clas = input("which class are you in? ").upper()
clas = checkclas(clas)
print (clas)
I tried to solve the problem with this code, but I couldn't. I want the program to check if the input class is valid, and then to print it, but it keeps going in the while loop forever, even though I input the right class. I think the problem is with the (or) statement. If anyone has got a solution please help me, this is for my computer science assessment, and the code has to be efficient.