Python 国际单项体育联合会声明及;否则将无法正常工作
它总是让我心脏病发作Python 国际单项体育联合会声明及;否则将无法正常工作,python,python-3.x,Python,Python 3.x,它总是让我心脏病发作 我是一个初学者,我想知道是否有其他方法可以做到这一点 最好每次都使用elif而不是if-else构造 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 th
我是一个初学者,我想知道是否有其他方法可以做到这一点 最好每次都使用
elif
而不是if-else
构造
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的基本教程可能是一个非常好的主意。你似乎遇到的问题应该被他们和许多其他有用的东西所涵盖。
if b1a == "rock":
print("you gave him a concussion and made the rock your new weapon")
weapon = "rock"
elif 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")
elif 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()
if b1a == "rock":
print("you gave him a concussion and made the rock your new weapon")
weapon = "rock"
elif 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")
exit()
elif 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()