Python Forum

Full Version: repeat function?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
is there a repeat function in python?
what I want to do is
use = input('Attack?')
if use == 'Yes':
    opponent_health = opponent_health - attack
    if opponent_health <= 0:
        print('You win')
    else:
        repeat()
thank you
You are already familiar with if/if-else statements. But from your other thread (https://python-forum.io/Thread-SenseHat-Frogger) I see you also know how to employ loops. My hint would be to search in that direction for a solution. Of course, feel free to ask further if you need more help =) Good luck!
Hello!
While loop will fits. While health is more than 0 - attack, sleep(1). For example
Hello ScarletSwitch, welcome to Python! Please use a meaningful title. I renamed this thread from "Python Question". Of course you have a python question. Everybody here does, that's why we post here :)
Thank you guys