Just convert Class to lowercase using str.lower() and test it.
if Class == "3" or Class.lower() == "three": f=open("class3.txt", "a+")
Of course, you can also use str.upper() .
if Class == "3" or Class.upper() == "THREE": f=open("class3.txt", "a+")
The last thing you can check is "3" and "three" at the same time with in .
if Class.lower() in {"3", "three"}: f=open("class3.txt", "a+")
When using in for an if , you have several options. You can use the set {"3", "three"} that I used, a list, ["3", "three"] or a tuple, ("3", "three") .
str.lower() final note - calling str.lower() or str.upper() on "3" will give you "3" , but calling it on the integer 3 will throw an error, so you cannot use in if 3 as an integer is possible Class value.
michaelpri
source share