To loop for infinity (or until a certain condition is met):
while True:
# Insert code here
if conditition_to_break:
break
This will call your code in an endless loop until condition_to_break
is True
and then breaks out of the loop.
You can read more on while
loops here.
If you want to repeat something n
times try using a for
loop (read more here).
for x in range(3):
# This code will execute 3 times
print("Executed {0} times".format(x+1))