很简单!我在哪里弄错了?我键入5并返回false ...我错过了什么?
# Make sure that the_flying_circus() returns True
def the_flying_circus():
print "Press number 5 otherwise it will return false"
a = raw_input()
if a == 5:
print "Correct!"
return True
# Start coding here!
# Don't forget to indent
# the code inside this block!
elif a != 5:
print "Wrong"
return False
# Keep going here.
# You'll want to add the else statement, too!
else:
return False
the_flying_circus()
print "Thank you for playing!"
答案 0 :(得分:3)
raw_input
总是返回一个字符串。 “5”不等于5。
答案 1 :(得分:2)
您需要将raw_input
转换为int
。
raw_input()
始终返回string
做a = int(raw_input())