0
Problem with or operator
Hi, I have no idea what I'm doing wrong with the code below. When I enter to that program number 1 or 2, in answer I get a "False", but in my opinion I should get a "True" s = input("Enter a number: \n") print(s) print(s == 1 or s == 2)
3 odpowiedzi
+ 8
input returns a string so you should convert it to integer using 'int' function
+ 5
You are entering a string, but conditionally checking for an integer.
Do:
s = int(input("Enter a number: \n")) instead.
0
Thanks :)