GRADE 7 · COMPUTING · UNIT 1 · LESSON 1.3

Block it out: Moving from blocks to text

Using Python IDLE in Script mode

Read a little. Try the workbook. Check your answers. Choose one section below to get started.

7 fillable worksheet pagesRead at your own pace

LET’S TRACE, REASON AND TEST

Using Python IDLE in Script mode

Use the IDLE Editor to create a saved .py script. Save your changes before running the module, then read its output in the Shell. The >>> prompt belongs to the Shell and is not part of the saved program. A # comment explains code without becoming an output instruction.

Today’s two goals
  • Create, save, open and run a Python script in IDLE.
  • Use output and arithmetic statements in a sequence and add an explanatory comment.
Original PaxaKids illustration for Using Python IDLE in Script mode. Precise program text and data are supplied in the workbook models.
An original PaxaKids workbook scene. Use the supplied programs and data for precise workbook facts.

Explore the clues

Tap one card to find out more.

Understand the idea

Use the IDLE Editor to create a saved .py script. Save your changes before running the module, then read its output in the Shell. The >>> prompt belongs to the Shell and is not part of the saved program. A # comment explains code without becoming an output instruction.

Concept to practise: Using Python IDLE in Script mode.

Work through an example

A saved script containing print("Club") followed by print(6 * 4) displays Club and then 24. Changing a line in the Editor changes the saved program only after you save it; checking the Shell alone does not repair the source.

Try before your workbook

You corrected a missing quotation mark in the Editor. What should you do before checking the output again, and where should that output appear?

Check my readiness thinking

Save the corrected script and run the module again. Read the new output in the Shell. A comment can explain the repair, but it does not execute the missing instruction.

Your original programs and learning models

These original PaxaKids program and data models support your workbook. Some examples deliberately contain faults to investigate. Follow their headings and preserve exact code case, punctuation and order. Traces and supplied records are not claims of physical testing.

From quick commands to a saved script

Our goal: create, save, reopen and run a script; use output, arithmetic and helpful comments; translate a short block sequence.

A script is a saved set of Python instructions. In IDLE choose File > New File to open an Editor. Type code there without the Shell prompt.

Create, save and run

  1. File > New File: open an Editor
  2. Type the program without >>>
  3. File > Save As: club_report.py
  4. Run > Run Module: execute the script
  5. Read and compare the Shell output

Trace a complete script

club_report.py
# Show a club greeting and calculate a total.
print("Coding club")
print((7 + 5) * 3)
print("All done")

Debug and check the intended result

A program can run successfully and still calculate the wrong answer. Maya needs to add 7 and 5, then multiply the sum by 3. She first types print(7 + 5 * 3), which runs but gives a different result. She checks the requirement before editing.

Translate the sequence

PLAN A
print("Club is open")
print("Choose a challenge")
print("Work with a partner")
PLAN B
print("Work with a partner")
print("Club is open")
print("Choose a challenge")

Build and preserve your program

In an approved IDLE Editor, create club_report.py using the complete page C program. Run it, then change the final message to a short message of your own. Save, close the Editor, reopen the file with File > Open, and run it again. If no device is available, prepare a clearly labelled paper version for a later demonstration.

Show that the translation works

Create a second file called club_messages.py from the page E block-style plan. Include a comment explaining its purpose. Save and run it, then explain the result to your partner. The teacher can demonstrate the run if your work is on paper.
Paxa the Fox

Try one step with Paxa!

Trace code carefully and preserve exact spelling, case and order. Use invented practice data. Save personal responses before leaving.

Our Unit 1 learning path
  1. Lesson 1.1: Comparing Scratch and Python
  2. Lesson 1.2: Using Python
  3. Lesson 1.3: Using Python IDLE in Script mode
  4. Lesson 1.4: Variables
  5. Lesson 1.5: Adding more information to a program
  6. Lesson 1.6: Data types – string, integer and real
  7. Lesson 1.7: Casting
  8. Lesson 1.8: Flowcharts and algorithms
  9. Lesson 1.9: BIDMAS in Python
  10. Lesson 1.10: Error detection and correction
  11. Lesson 1.11: Making choices IF THEN ELSE in flowcharts
  12. Lesson 1.12: Sub-routines
  13. Lesson 1.13: Random questions and a star number
  14. Lesson 1.14: Final project
  15. Lesson 1.15: Evaluation
  16. Lesson 1.16: What can you do?
For grown-ups: using this lesson

Your answers are checked in your browser. Open responses need grown-up review and are shown separately from the automatic score. Check your work, then use “Retry answers to practise” to revisit mistakes while keeping correct responses.

Read one explanation, discuss the model and try the readiness check before the workbook. Choose “Mark lesson finished” when ready. Optional account progress saves lesson position and completion across devices; save personal responses before leaving.

2. Fill in your workbook

Read the teaching and the complete workbook instructions. Choose, write or draw; Answer list offers larger controls. Trace code precisely and distinguish predictions from actual tests. Review designs, explanations and drawings with a grown-up.

Using Python IDLE in Script mode7 student pages · original artwork

Opening your PDF…

Swipe sideways across the worksheet on a small screen, or use “Answer list” for larger controls.

TAKE YOUR PRACTICE OFFLINE

3. Download the student worksheet

All 7 original A4 student pages, ready for pencil-and-paper practice. Choose Review Answers to check your work on this webpage.

Student worksheet only · PDF · 8.0 MiB · No answer key included

Download worksheet PDF ↓

TRY FIRST, THEN CHECK TOGETHER

Download the student worksheet →

4. Answers & guidance

Finished your try? Open the guide and compare one worksheet at a time. Your own words may be different and still explain the right idea.

Shown on this webpage only. There is no answer-key download, and this guide is left out when printing the page.

Show answers for all 7 worksheets

Worksheet 1

  1. Question 1: Which IDLE area holds the script you edit? Editor
  2. Question 2: Which ending normally identifies a Python source file? .py
  3. Question 3: What should you leave out when typing a script? the Shell prompt >>>

Worksheet 2

  1. Question 4: Where should you look for the script output? Shell
  2. Question 5: You edit a line. What should you do before testing it again? save the changed script

Worksheet 3

  1. Question 6: What is the first output line? Coding club
  2. Question 7: What number is printed on the second output line? 36
  3. Question 8: Which line is not displayed as output? the comment beginning with #

Worksheet 4

  1. Question 9: What result does print(7 + 5 * 3) actually display? 22
  2. Question 10: Which replacement follows Maya’s requirement? print((7 + 5) * 3)
  3. Question 11: Which comment best explains the correction? # Group the addition before multiplying.

Worksheet 5

  1. Question 12: Which plan preserves the message sequence? Plan A
  2. Question 13: How do you open a previously saved script in IDLE? File > Open, then select the .py file
  3. Question 14: Which action checks that saving really worked? close, reopen and rerun the saved file

Worksheet 6

  1. Question 15: Record the saved file name and folder, your expected output lines and the output after reopening. Include one helpful # comment and explain what you changed. Do not claim a software run if you only traced it. Look for a real .py file or clearly labelled paper preparation, the exact ordered outputs Coding club /36 /chosen final message, a relevant comment and evidence of reopening and rerunning. Folder names vary. Comments begin with# outside quoted text and should explain purpose or a correction. No personal information is required. Grown-up review; personal evidence is required.

Worksheet 7

  1. Question 16: Write your translated Python code and its expected output in order. Record whether you ran it or traced it. Explain how the output shows that your translation follows all three block instructions. Accept three valid print calls for Club is open /Choose a challenge /Work with a partner, in that order, with a useful comment. Matching single or double straight quotes are valid. No green-flag Python line and no>>> prompts. Evidence must distinguish actual execution from paper trace. Explanation uses message content and order, not just “it works”. Grown-up review; personal evidence is required.
Back to my workbook ↑

Curriculum & workbook reference

Computing for your homeschool day

Explore Using Python IDLE in Script mode with this free Grade 7 Computing lesson. Read one idea together, try the fillable workbook and return to review at your own pace. Download the same student worksheet PDF for pencil-and-paper practice.

Fit learning around your family’s day. There is no timer and no sign-up is needed to use the lesson. An optional account saves your lesson position and completion across devices. Workbook responses and drawings stay in this tab; save a copy of your responses before leaving.

Understand your results

Your answers are checked in your browser. Open responses need grown-up review and are shown separately from the automatic score. Check your work, then use “Retry answers to practise” to revisit mistakes while keeping correct responses.

Choose Review Answers after trying the activity. The guide stays on the webpage; the worksheet download contains only the student pages.

For programme background, visit the Cambridge Lower Secondary Computing overview. PaxaKids provides independent original companion practice.

The book pages identify the related teaching topic. The explanations, characters, programs and exercises here are original PaxaKids companion practice. Practical tasks require the appropriate editor and, where applicable, suitable equipment. A design or paper trace is not a verified hardware result. Only completed, reviewed lessons are listed.

Explore the Cambridge Lower Secondary Computing curriculum for programme background. PaxaKids is an independent learning resource.