Even or odd without condition statement | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

Even or odd without condition statement

x=input('enter any number: ') y=x%2 print (book(y)) I'm trying to say whether given number is even or odd using Boolean. but I'm getting error.....help me with this.

14th Feb 2019, 12:59 PM
Uthpala
5 Respuestas
+ 2
print(bool(y)) not book!
14th Feb 2019, 1:18 PM
LetterC67
LetterC67 - avatar
+ 2
You need to convert the input into int first with int(x).
14th Feb 2019, 1:55 PM
HonFu
HonFu - avatar
+ 1
sorry typo error...I have given bool
14th Feb 2019, 1:20 PM
Uthpala
+ 1
Thanks HonFu :)
14th Feb 2019, 1:57 PM
Uthpala
0
got it
14th Feb 2019, 1:57 PM
Uthpala