7th Jul 2018, 10:04 PM
Neeb132
Neeb132 - avatar
7 Respostas
+ 1
you need to convert the value returned by input to int or float: num = int(input())
7th Jul 2018, 10:10 PM
Ulisses Cruz
Ulisses Cruz - avatar
0
That makes it always report odd...?
8th Jul 2018, 2:43 AM
Neeb132
Neeb132 - avatar
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.
8th Jul 2018, 7:24 AM
Mustafa Yıldız
Mustafa Yıldız - avatar
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")
8th Jul 2018, 4:39 PM
rahim shahbazizadeh
rahim shahbazizadeh - avatar
0
Thanks!
9th Jul 2018, 4:59 PM
Neeb132
Neeb132 - avatar
0
🙏
19th Jul 2018, 5:28 AM
rahim shahbazizadeh
rahim shahbazizadeh - avatar