Repeating a function in Python

To loop for infinity (or until a certain condition is met): 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).