Why is this program saying two when 2 input 1 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why is this program saying two when 2 input 1

Input() If input ==1: print("one") else: print("two")

30th Sep 2020, 11:14 PM
$BANANA$
2 Answers
+ 4
incomplete code. hoping you mean if input() == 1 : print("one) else : print(" two") Input accept input in the form of strings.. So you need to cast it to int like int(input()) Now check this code : if int(input()) == 1 : print("one) else : print("two")
30th Sep 2020, 11:42 PM
Jayakrishna 🇮🇳
+ 2
i = int(input()) if i ==1: print("one") else: print("two")
1st Oct 2020, 12:01 AM
**🇦🇪|🇦🇪**
**🇦🇪|🇦🇪** - avatar