Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
repeat function?
#1
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
Reply
#2
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!
Reply
#3
Hello!
While loop will fits. While health is more than 0 - attack, sleep(1). For example
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#4
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 :)
Reply
#5
Thank you guys
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Why do I have to repeat items in list slices in order to make this work? Pythonica 7 1,258 May-22-2023, 10:39 PM
Last Post: ICanIBB
  Repeat request by else stsxbel 2 1,150 Jul-30-2022, 03:34 PM
Last Post: stsxbel
  get out of while loop and stop repeat Frankduc 11 2,866 Apr-26-2022, 10:09 PM
Last Post: deanhystad
  Avoid multiple repeat in indent Frankduc 8 2,790 Jan-18-2022, 05:46 PM
Last Post: Frankduc
  How to discard list repeat values akanowhere 7 3,576 Dec-28-2020, 09:14 PM
Last Post: akanowhere
  I want to check if the input is str or is int & if it's str repeat the loop HLD202 4 2,722 Nov-23-2020, 11:01 PM
Last Post: perfringo
  is there a way: repeat key word args Skaperen 2 2,200 Feb-03-2020, 06:03 PM
Last Post: Skaperen
  Python Script to repeat Photoshop action in folders and subfolders silfer 2 4,506 Jul-25-2019, 03:12 PM
Last Post: silfer
  Trying to Repeat a Function? DanielHetherington 1 2,310 Mar-27-2019, 09:48 PM
Last Post: SheeppOSU
  While loop repeat Runner83 5 4,200 Nov-11-2018, 10:50 AM
Last Post: MasterJediKnight7

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020