我在制作这个循环工作时遇到了麻烦,任何帮助/建议都会非常感激.
这是循环(它不是完整的程序):
import random
while your_health or enemy_health >= 10:
print("He is still attacking you.")
print("you may either:"
"a-dodge"
"b-attack back")
fight_choice_1_1 = input("What do you do?")
if fight_choice_1_1 == "a":
d20_1_1 = random.randint(1, 20)
if d20_1_1 >= 10:
print("you dodge the attack")
elif d20_1_1 <= 10:
your_health -= knife_damage
print("you get hit")
if your_health <= 0:
print("you lose. :(")
elif enemy_health <= 0:
print("you win!")
if fight_choice_1_1 == "b":
d20_1_1 = random.randint(1, 20)
if d20_1_1 >= 10:
print("you get …Run Code Online (Sandbox Code Playgroud)