I'm trying to only allow the letters a, b or c in an input for a .dat file in a Python program (code below), but I'm having difficulty getting the program to do this correctly.
varClass = "class" + input("Which class are you in? [A/B/C]: ").lower() + ".dat"
if not re.match("^[a-c]*$", varClass):
print("Enter the correct class number")
This is what I have already, but it still continues to run even after an incorrect character has been entered.
varClassalready contains "c" and "a" because you preppend "class" :X