我在下面的代码片段中有一个 if/elif 语句...出于某种原因,即使我触发了 elif 语句,控制台仍然会打印 if 语句而不是 elif ...我确定我错过了一些愚蠢的东西。
use_stim = str.lower(input("你想现在使用这个stimpak吗?"))
if "ok" in use_stim or "okay" in use_stim or "yes" in use_stim or "sure" in use_stim or "you bet" or "good idea" in use_stim:
char_health = char_health + char_stim_heal
char_stims = char_stims - 1
print(char_name + ": Using stimpak, I feel better")
print("")
print("***STATS***")
print("Health:" + str(char_health))
print("Stimpaks:" + str(char_stims))
print("***STATS***")
print("")
search_next = str.lower(input(char_name + ": Alright, what's next? Weapons or amunition?"))
print(username + ": " + search_next)
elif "no" in use_stim or "nope" in use_stim or "never" in use_stim or "no way" in use_stim or "not a chance" in use_stim or "i don't think so" in use_stim:
print(user_name + ": " + use_stim)
print(char_name + ": Alright, i'll save it for later.")
char_stims = 1
char_health = 75
print("")
print("***STATS***")
print("Health:" + str(char_health))
print("Stimpaks:" + str(char_stims))
print("***STATS***")
print("")