+ 1

Simple Question.I entered 7. Why is the program not printing 7, True. It is printing 7,False

a=input("enter a number") print (a) print(a==7)

1st Sep 2019, 8:06 AM
Yogi Next door
Yogi Next door - avatar
2 Antworten
+ 6
because "7" != 7 input() returns a string to compare it in the right way with a integer (7) you need to convert it using the function int() like this: Simple Question.I entered 7. Why is the program not printing 7, True. It is printing 7,False a=int(input("enter a number")) print (a) print(a==7)
1st Sep 2019, 8:17 AM
Anton Böhler
Anton Böhler - avatar
+ 1
thanks a lot 🙏🏼⭐️
1st Sep 2019, 10:05 AM
Yogi Next door
Yogi Next door - avatar