A = raw_input("5 + 5 =")
if A == 10:
print "$"
elif A <> 10:
print "!"
when I input 10 I also get "!" why?
A = raw_input("5 + 5 =")
if A == 10:
print "$"
elif A <> 10:
print "!"
when I input 10 I also get "!" why?
raw_input returns a string, so you're getting back "10"
(according to my terminal).
10 == '10'
yields false. You need to cast the input to a number.
A = int(raw_input("5 + 5 ="))
Because the result of your call to raw_input
is a string, not an integer.
You are comparing 5+5 == "10"
, which is false.
Trying using the int("str")
function to convert your input to a number.