Reputation: 1
I want to validate that the class is a number between 1 and 6. Any help would be greatly appreciated.
print("What is your name?") #Asking User Name
name = input().title()
class_name = input("What class are you in? ")
print (name, ", Welcome to the Maths Test")
Upvotes: 0
Views: 25
Reputation: 324
You can try by using an if condition which checks the value your entered is between 1 and 6:-
if not int(class_name, 16)>1 and int(class_name, 16) < 6:
print "Your validation message"
Upvotes: 1