Using Python v2.x, I have 3 variables that I want to ask the user for, as below:
def Main():
chars = set('0123456789')
while True:
Class_A_Input = raw_input('Enter Class A tickets sold: ')
Class_B_Input = raw_input('Enter Class B tickets sold: ')
Class_C_Input = raw_input('Enter Class C tickets sold: ')
if any((c in chars) for c in Class_A_Input):
break
else:
print 'Wrong'
total_profit((int(Class_A_Input)), (int(Class_B_Input)), (int(Class_C_Input)))
How can I check if the user input is a valid input. IE: I want only numerical data entered. I have done this once before using 'chars = set('0123456789') and the 'WHILE' functions, but cannot seem to get it to work for multiple inputs.
Thanks for any help.
EDIT: I have put the code in now as I have it. I moved the 'int' to the 'total_profit' variable. How can I check all inputs?