lesson 3.1.1 from blocks to text
Graduating to Thonny

Hello and welcome to text-based programming! You have already learned how to think like a programmer using a block-based languageI have no idea what this means in Key Stage 2. Now, you are going to learn how to write programs like a professional, using a text-based languageI have no idea what this means called PythonA high-level, text-based programming language known for its clear, readable syntax..
Learning Outcomes
The Building Blocks (Factual Knowledge)
The Connections and Theories (Conceptual Knowledge)
The Skills and Methods (Procedural Outcomes)
Recall that a high-level language requires a translator (interpreter) to be understood by a computer.
Describe a text-based language (Python) as a way to give precise instructions to a computer.
Describe a source code editor as a tool with features like syntax highlighting to help programmers.
Recall that a string is a data type for text and must be in quotes.
Recall that a comment starts with a # and is ignored by the computer.
Describe a syntax error as a "grammar" error that stops the program from running.
The Connections and Theories (Conceptual Knowledge)
Analyse the similarities and differences between a block-based language and a text-based language, concluding that both use the same core programming logic (e.g., sequence).
Explain why precise syntax is essential in a text-based language, whereas a block-based language prevents syntax errors by design.
The Skills and Methods (Procedural Outcomes)
Apply knowledge of an IDE to write a simple program using a text editor with syntax highlighting.
Apply the correct syntax to create comments in code to explain its purpose.
Create a simple program that displays a string of text using the
print() function.Digital Skill Focus: In this lesson, you will practice the skills of navigating a website and interacting with a live 'widget'.
Your New Coding Environment: The IDE
From now on, you'll be using an Integrated Development EnvironmentSoftware tools used to write code. Often include features like code editors, syntax highlighting, run-time environment, breakpoint / debugging tools etc., or IDEI have no idea what this means to help you to write, run and debug code. For some of the course, we will be using a special online Python "widget" IDE...

The Python Widget IDE
...but, for a more challenging experience, we will use a popular desktop IDE called Thonny.

The Thonny IDE
An IDE is just a program that bundles all the tools a programmer needs into one place. For us, they have three super-important parts:
A Code EditorI have no idea what this means: This is just like a text editor (like Notepad). This is where we write and save our main program, which is called our source codeThe human-readable set of instructions written by a programmer in a high-level language..
An InterpreterLanguage translator which converts source code into object code one command at a time. Usually platform independent.: This is a behind the scenes program which takes our source code and converts it into a format that the computer can run.
A ShellAn alternative name for the interface of an interpreter.: We will see all our output here (like any text we print), and we can also use it to quickly test single lines of code and interact with our program.
Your first program
The first command (or function) every programmer usually learns is
print(). Its job is simple: it tells the computer to display whatever you put inside the parentheses (that's a fancy name for brackets) to the shell. When we want to print text, we have to tell Python that it is text. We do this by wrapping it in quotation marks (""). Any text inside quotes is called a stringA sequence of characters delimited with quotation marks..
Task 1 The Python Widget
To help you to get started, here is a simple Python Widget IDE for which runs right here, in the browser! We won't always be using this but it's useful to introduce you to a new concept so you don't have to create your own Python script on your computer.
Lines starting with a hash sign (
#) are comments. They are ignored by the interpreter but are useful for humans to explain how the code works.
The Python Widget IDE
1
How do I use it?
You type or edit the Python code in the Code Editor.
You run the code by clicking the Run Script button.
Any output that the script generates appears in the Output window.
You can reset the code by clicking the Reset button.
You can clear the output window by clicking the Clear Output button.
Sometimes (like in the image), you might also see the following...
A Copy button at the top right of the Code Editor
A Print to PDF button
A Theme chooser
2
Try it out!
Follow the intructions carefully.
1
Predict what the code will do when you click Run Script.
2
Run the script by clicking the Run Script button - were you right?
3
Investigate how the script works.
What happens if you remove the brackets from the
print statement?What about removing the quotation marks from the
print statement?Does it still work if you CAPITALISE the word
print?Try changing the hash sign (
#) to something else or removing it completely. What happens?Reset the script before you move on by clicking the Reset button.
4
Modify the script
Change the string in the print statement to output
I can use Python!.Change the comment in the first line to something different.
5
Make something new!
Add a new
print() statement on line 3 which outputs This is easy peasy :)Add a new comment on line 4 which says
# This is the end!Outcome: I can use the Python Widget to predict, run, investigate, modify and create Python code.

Here comes Thonny
OK, so we've learnt how to use the Python Widget so now it's time to have a go with Thonny. Your teacher will demonstrate how to...
open Thonny,
create a new Python script,
save the script using the correct file extension and then
run the script.
Watch and learn...

Task 2 A Greeting, how to break it and how to fix it again
Part A: Hello!
Now it's time to write your first program using the Thonny IDE. Follow the instructions carefully, step-by-step; ask your teacher for help if you need it.
1
Get ready to code
Open the Thonny IDE on your computer. Make sure you are happy that you know where to type your Python code, how to run the program and where the output will appear. Ask your teacher if you are struggling.
2
Code!
In the code editor (the main top window), type the following two lines (without the line numbers):
# This is my first program
print("Hello, my name is John!") Go to File > Save and save your program. Call it
hello.py. The .py is very important, it's called a file extensionI have no idea what this means and it tells your computer which program it should use to open and run the file.3
PRIMM it!
Predict what the script will do when you run it
Run the script by clicking the green 'play' button. Look at the output in the shell. Were your predictions correct?
Investigate the code
What is the line beginning the the hash sign (
#) for?What does the
print() statement do?Why do we have to enclose the string in quotation marks?
Modify the code
Change the code to print your name rather than
John.Add an extra line to the end of the script to print out a new string
I am learning to code in Python!Make a new python script that introduces you but also states your favourite hobby on a separate line.
Part B: Debugging
The most important skill a programmer has is learning how to fix errors. This is called debuggingI have no idea what this means. An error does not mean you've failed; it's just the computer giving you feedback. A syntaxThe 'grammar' of a computer programming language. error means you broke the grammar rules of the language like making a grammar error in English. It's just that the computer isn't as clever as your English teacher and can't work out what you meant.
Did you know? The history of "debugging" began with a real insect in 1947, when Admiral Grace Hopper's team found a moth causing a Mark II computer to malfunction.
1
A new (broken) Python script
Create a new
.py file in Thonny with the following contents (copy and paste it from here).$ A program to state my location and my age
Print("I am from the moon."
print("I am "25" years old)2
Debug 🪳
The challenge is to fix the 6 errors in this script. Show your teacher when you have completed it.
Outcome: I can write, save, and run a Python program. I can also identify and fix a simple syntax errors.

print() command, add comments, and fix syntax errors.Out of Lesson Learning
Last modified: October 14th, 2025
