Hardware Reference
In-Depth Information
6. Save your program and run it using Run Run Module from the editor menu.
You should be having a lot of fun with the game now because you have to plan your strat-
egy carefully, running in and out of the field to avoid getting catapulted into the sky!
Now, as you did before, choose a variety of objects and scatter them randomly around
the field. Challenge yourself and your friends to “collect” (that is, destroy) as many blocks
as you can, while clocking up the smallest possible rent bill. (See Figure 2-10.)
FIGURE.2-10 Your player is catapulted up into the sky when he has been in the
field for too long.
DIGGING INTO THE CODE
You have now used two new parts of the Python language, and these need to
be explained further.
First, you used an else statement. else is an optional part of an if statement.
It should always be at the same indent level as the if that you pair it with, and
the statements that you want to run as part of the else should also be indented.
Here is an example:
if a>3:
print("big")
else:
print("small")
 
Search WWH ::




Custom Search