我有一个用户输入,然后是一个“if 语句”,但是在这个 if 语句中我想检查两个不同的变量?无论我尝试什么,它都不起作用。
if hm == 3 and karma == 8:
print ("hello whatever")
这就是我已经尝试过的,但它是错误的,那么我用什么来检查两个不同的变量,谢谢?
编辑:所以我只是在尝试制作一个迷你游戏......这是我到目前为止的代码
发生的情况是,当它到达问题区域时,它只是跳到结尾消息
import time
x = 1
karma = 0
money = 50
ticket1 = 1
name = input("what is your name")
print ("hello", name)
time.sleep(1.5)
check = input("would you like to start your adventure")
if check == "yes" or "Yes" or "yeah":
print ("good then lets get going")
else:
print ("bye loser")
SystemExit
time.sleep(1.5)
print ("you are walking down a road on the way to the shops, when all of a sudden a homeless man asks you for some change")
time.sleep(1)
hm = input("do you 1. give the man all your money, 2. give him some small change, 3. tell him to eff off")
if hm == "1":
print("you gave the man all your money, karma + 10, you have no money now")
money = 0
karma = 10
x = 1
if hm == "2":
print ("you give him $10, karma + 2, you have $40 left")
money = 40
karma = 2
x = 1
if hm == "3":
print (" you tell the man to fuck off, he looks hungry and disappointed, turns out he died later that day. karma - 5, you have $50 left")
money = 50
karma = -5
x = 2
print(".")
print(".")
print(".")
print(".")
time.sleep(1.5)
print ("a bit further down the road you pass a street salesman selling golden tickets,")
time.sleep(1.5)
print("he say's .. they will be worth it later on in the game , honestly..")
time.sleep(1.5)
check1 = input("do you 1. buy a ticket ($5) 2. don't buy a ticket 3. threaten to punch him unless he gives you a ticket")
time.sleep(1)
if hm == 3 and karma == -5:
money + 5
print("you beat the shit out of him and take a golden ticket as well as $5, karma -5, you have", money, "dollars left")
karma = -10
ticket1 + 1
if hm== 3:
print ("he cowers under your influence and gives you a ticket you have ", money, "dollars left, karma - 5")
karma -5
ticket1 + 1
if hm == 2:
print ("you walk on withought buying a ticket, no change in karma, you have ", money, " dollars left")
if hm == 1:
money -10
ticket1 +1
print("you buy a golden ticket, you have ", money, " left")
print("well thats all folks")