1st Feb 2018, 10:14 PM
Raphael Shay
Raphael Shay - avatar
2 ответов
0
the problem is here str(x) % 2 == 0 should be int(x) % 2 == 0 Also you could do your if statement like this if(x not in number): print("Please enter numbers and not letters.") And don't call oddOrEven() function if the input is letter else you will get value error
1st Feb 2018, 10:23 PM
Toni Isotalo
Toni Isotalo - avatar
+ 2
you could speed things up by using set insted of list of strings digits={0,1,2,3,4,5,6,7,8,9} x=input() if x.isdigit() and (int(x) in digits): do something here when you know you have number in 0-9 range
1st Feb 2018, 11:48 PM
Kuba H
Kuba H - avatar