Before we start programming in Python, we’re going to do a quick recap using the Python commands that have been printed out for the previous lesson, comparing them to blocks you should recognise from Scratch. Then we will use something called pseudocode to describe the flow of a program and help us to plan it. You can start to make things slightly more challenging by putting together a sequence of blocks together and asking students how they would recreate those moves.
The pseudocode example could be what is on the ppt or it could be something else, like:
Get Marty to turn 90 degrees to the right
Have Marty take 5 steps forward
Have Marty do a wiggle at the hips, after the 5 steps
USING THE PYTHON SHELL
You can read our getting started guide that has been included in this lesson pack for instructions on installing and setting up everything you need to program Marty in Python with IDLE. Once you have everything installed and ready to go, the first window that pops up when you start the application will be the Python shell. This is the window that students should start typing in their individual commands into. Firstly, starting off with importing the MartyPy library and connecting to their Marty using an IP address (this information is covered in our guide). Get students to experiment with typing in the commands that we have printed out and see them happen in real life.
MOVEMENT DIcE GAME
Once students are comfortable with using some of the Python commands for Marty, it’s time to create short scripts and run them. There are instructions in our guide for creating and running Python scripts with IDLE. Ensure that students save each of the challenges that they attempt when playing the movement dice game with other groups so that, at the end, they can easily run all of them again!