+ 2
Why does this not work?
2 Respostas
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
+ 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