A video game repeats the action until all the players’ lives have gone, or the end of the game has been reached. So far, we have only written programs that run through a sequence of commands and then terminate. With the use of certain Python keywords, we can get the computer to repeat a block of code when required, either using conditions or for a set number of times.
© Sloan Kelly 2019
Sloan KellyPython, PyGame, and Raspberry Pi Game Developmenthttps://doi.org/10.1007/978-1-4842-4533-0_66. Making the Raspberry Pi Repeat Itself
Sloan Kelly1
(1)
Niagara Falls, ON, Canada
The ‘for loop’ in Python takes a list, and for each item in the list it performs a series of action. These actions are contained within the block of code that appears ...
Get Python, PyGame, and Raspberry Pi Game Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.