Apr-09-2018, 05:01 PM
Hi,
I'm getting a syntax error on the "try".
Why is this?
I'm getting a syntax error on the "try".
Why is this?
def bossFight(): print(""" The ghost is revealeed to you as Arnold! """) print("The boss still has " + str(bosshealth) + " remaining!") print("You still have " + str(playerhealth) + " remaining! Good luck!") while playerhealth > 0 and bosshealth > 0: print(""" Arnold glares at you. Do you choose to attack or defend? 1: Attack 2: Defend """) choiceBoss = int(input("Do you attack or defend?: ") try: if choiceBoss == 1: print("You attack the boss for 23.6 health!") bosshealth -= 23.6 print("The boss has " + str(bosshealth) + " remaining!") print() elif choiceBoss == 2: print("The boss attacks you for 10.0 health!") playerhealth -= 10.0 print("You have " + str(player) + " remaining!") print() if playerhealth < 0: print("You have been defeated.") youLose() if bosshealth < 0: youWin() else: continue except NameError: print("Type an integer to reflect your answer!") prompt4()