can you use a or in an if else statement | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

can you use a or in an if else statement

num = input() if num == 7 or num == 8: print("good job it's either 7 or 8") else: print("guess again")

26th Mar 2019, 1:20 AM
Hacked JJSJSJS
Hacked JJSJSJS - avatar
2 Answers
+ 3
That is okay but you have to first convert input to int then you can compare them for equality with 7/8
26th Mar 2019, 3:23 AM
Saksham Jain
Saksham Jain - avatar