+ 2
Why won't my code work?
Here's the link: https://code.sololearn.com/c1dQHVUqRsOX/#py
7 Answers
+ 1
you need to convert the value returned by input to int or float:
num = int(input())
0
That makes it always report odd...?
0
Instead of making input int, you may do like
data = int(num) / 2
Then input would stay as string and you'll still get the expression right.
Cuz otherwise when printing it errors 'int + str'. So that would do the trick I guess.
0
please change to
num = int(input())
print ('Great.')
data = num / 2
if type(data) == float:
print (num)
print("is odd")
else:
print (num)
print ("is even")
0
Thanks!
0
đ