@Tinius the ``` are just for this forum so that you code prints nicely.
Are you looping your code or is this all of it? Loops allow the code to repeat each iteration of the game and allow the hero to try an attack again and again.
Without the loop, you are just asking the game: “Does an enemy exist, if not then do nothing.” only one time.