【发布时间】:2020-07-26 19:35:14
【问题描述】:
if b1a == "rock":
print("you gave him a concussion and made the rock your new weapon")
weapon = "rock"
else:
print("you had a heart attack because you didn't pick one of the options")
exit()
if b1a == "NIGERUNDAYO":
weapon = "tommy gun"
print("You ran so much that the beast got tired, then you took out a tommy gun and started shooting")
else:
print("you had a heart attack because you didn't pick one of the options")
exit()
if b1a == "slash":
print("you slashed his face with a hatchet. ")
else:
print("you had a heart attack because you didn't pick one of the options")
exit()
它总是让我心脏病发作。
我是初学者,想知道是否有其他方法可以解决这个问题。
【问题讨论】:
-
你需要
elif。 -
如果您是初学者,那么在这种情况下阅读一些有关 Python 的基础教程可能是一个很好的主意。您似乎遇到的问题应该被他们和许多其他有用的东西所涵盖。
标签: python python-3.x