How to take input in python. | Sololearn: Learn to code for FREE!
0

How to take input in python.

whenever i try for input the program doesn't work like: x=input() if x==5: print("working") else: print("not working") then i give input 5 but result show not working. can someone plz explain? thank you.

26th Mar 2017, 1:44 PM
Vaibhav Singh
Vaibhav Singh - avatar
4 Answers
+ 7
x=input() puts a string in x. If you input 5, x will become string "5", which is not equal to integer 5.
26th Mar 2017, 1:51 PM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 2
use raw_input()
26th Mar 2017, 2:03 PM
Mayur Chaudhari
Mayur Chaudhari - avatar
0
use x = int(input())
26th Mar 2017, 8:22 PM
Logan New
Logan New - avatar
- 1
x = input(" ") if (x == 5): print("working") else: print("not working")
26th Mar 2017, 2:04 PM
Mayur Chaudhari
Mayur Chaudhari - avatar