Python Run Stage Sorter¶
Run the Python Run Stage Sorter MicroSim Fullscreen
You can include this MicroSim on your website using the following iframe:
<iframe src="https://dmccreary.github.io/robot-arm/sims/python-run-stage-sorter/main.html"
height="574px" width="100%" scrolling="no"></iframe>
Description¶
Open the six stages a Python script passes through between pressing Enter and seeing output, then sort five real error messages onto the stage that produces each one. Used in Chapter 1.
The six stages are listed in order. In the wide layout they run down the left side with an arrow from each stage to the next. On a phone they stack above the text panel.
Each error message is drawn in a dark box, the way a terminal shows it. The messages are real Python 3.13 and zsh messages. The folder name /home/maker/arm-lab is only an example.
Lesson Plan¶
Grade level: Middle school and up (age 12+). Time: 5 to 10 minutes.
- Open every stage. Click each of the six stages, or pick it from the Stage menu. Read what happens there and what can fail there. The sorting stays locked until all six have been opened.
- Sort. Press Start sorting. For each message, click the stage that produces it and press Check. You get one attempt per message.
- Read the feedback. The correct stage turns green and the reason is shown. A wrong choice is marked in red.
- Review. The last screen shows your score and the five messages beside their stages. Mastery is 4 of 5.
- Think about it. Two messages land on stage 5 and none land on stages 1 or 6. Why does only a
SyntaxErrorappear before any line has run?
Specification¶
The learning objective, evidence of mastery and content for this MicroSim are specified in Chapter 1: Setting Up Python for Robotics.
References¶
- Using the Python Interpreter - The Python Tutorial - How the interpreter is started and how it reads a script.
- Errors and Exceptions - The Python Tutorial - The difference between syntax errors, found before a program runs, and exceptions, raised while it runs.