+ 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)
2 Respostas
+ 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)
+ 1
thanks a lot 🙏🏼⭐️