'Need help trying to loop my enemies after they have died

 while phealth > 0
     while choice !a:    
       if choice.lower() == "a":
            print('You attack the',name,"and do",pstrength,"damage!")
            if random.random() < crit_chance:
                print('You got a critical hit +5 more damage')
                mhealth = mhealth - pstrength - 5
                print(mhealth)
            else:
                mhealth = mhealth - pstrength
                penergy = penergy - pstrength
                print(mhealth)
            if penergy <= 0:
                print('You ran out of energy but thankfully the old man saved but you lost',random.randint(0, pcoins),'coins.')
                coins = 0
            if mhealth <= 0:
                print('You killed the enemy and gained 1 coin')
                pcoins = pcoins + 1

The code just keeps going. I would rather want it to reset at the beginning of the loop after the enemy has died.

This is not a full version of the code!!!



Solution 1:[1]

As posted by @ewz93 the code needed a reset message at the end!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Blastfurnace