如果donate_money = 0并且spend_money是20,那么它应该检查第一个if语句并转到black_room吗?
def white_room():
spend_money = raw_input("How much money have you spent?")
donate_money = raw_input("How much money have you donated?")
if (donate_money <= 0 and spend_money > 10):
print "You go to the black room!!"
black_room()
elif (donate_money > 0 and spend_money > 10):
print donate_money
print spend_money
print "You can stay here..."
white_room()
else:
print "You can live in the silver room forever"
答案 0 :(得分:0)
将raw_input
更改为input
,有关详细信息,请参阅How can I read inputs as integers?
spend_money = input("How much money have you spent?")
donate_money = input("How much money have you donated?")