0

Python 3 learning syntax error that I don't understand

HI all, I'm not using this code for any real game. Just testing it using my old college knowledge of Python (dropped out) mixed with what I've learned in Sololearn. I'm getting this error File "C:/Users/rober/PycharmProjects/OrcFighting/orcFight.py", line 38 break ^ SyntaxError: invalid syntax in this code level = 1 gold = 20 health = 15 orc = 20 Iron_sword= 1 iron_durability = 10 Steel_sword = 2 steel_durability = 20 print("You are walking through a forest") print("You encounter an Orc!") print("Would you like to fight the Orc? (y/n)") fighting_choice = input() if fighting_choice == "y": fighting = True elif fighting_choice == "n": fighting = False if fighting == False: print("You have ignored the orc.") elif fighting == True: while fighting == True: print("What would you like to attack the orc with?\n Iron_sword (1 dmg\n Steel_sword (2 dmg).") userWeapon = input() if userWeapon == "Iron_sword": print("You attacked the orc with the iron sword for 1 damage.") orc -= 1 print ("The orc has " + str(orc) + " health left") health -= 1 print("The orc has attacked you for 1 damage, you have " + str(health) + " health left.") if orc == 0: print("The orc is dead, you win!") gold += 10 print("You got 10 gold, you have " + str(gold) + " gold." break if health == 0: print("You died, game over :(") break elif userWeapon == "Steel_sword": print("You attacked the orc with the steel sword for 2 damage.") orc -= 2 print("The orc has " + str(orc) + " health left") health -= 1 print("The orc has attacked you for 1 damage, you have " + str(health) + " health left.") if orc == 0: print("The orc is dead, you win!") gold =+ 10

14th Apr 2020, 7:49 PM
Nyaa
Nyaa - avatar
1 Resposta