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.
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. A popular one for learning Python is called Thonny.

The Thonny Interface
An IDE is just a program that bundles all the tools a programmer needs into one place. For us, it has two super-important panels:
The EditorThe main window in an IDE where you write and save your source code. (top panel): 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..
The ShellAn alternative name for the interface of an interpreter. (bottom panel): This is where our program runs. 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.

Task 1 Code Translator
1
Get sorted!
Before we touch the computers, let's prove that you already know how to translate code from block based code like Scratch into Python. In your pairs, your teacher will give you a set of cards. Some show Scratch blocks you already know, and some show the new Python code. Your job is to match the block to the code that does the same thing!
2
Make some notes
Write about what you have done on your lesson sheet. You might want to use a table?
Outcome: I can match common Scratch blocks to their new Python text commands.

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 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..
Try running the following code. Experiment by changing the text inside the quotation marks and see what happens.
1
You run the code by clicking the Run Script button.
2
You can reset the code by clicking the Reset button.
3
You can clear the output window by clicking the Clear Output button.
Adding Comments
One last thing! Programmers need to leave notes for other humans (and for their future selves) to explain what their code does. We do this with a commentA line in a computer program which is ignored by the language translator and is only included for the benefit of programmers.. In Python, any line that starts with a hash symbol (#) is a comment. The computer ignores it completely.

Try running the following Python script and notice what happens in the shell.
Now, change the text in the comment and run the script again. You could even add extra comments but make sure that you prefix (start) each line with a hash symbol (#).
Did you see the text you typed in the comments appear in the output window? Something went wrong if you did! Remember, comments are there to allow you to describe what your code does to other humans.

Task 2 A Greeting (and how to break it)
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.
Part A: Coding
1
Get ready to code
Open your IDE (Thonny). 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 Editor (the main top window), type the following two lines (without the line numbers):
# This is my first program
print("Hello, my name is...")
(Make sure to put your own name in the string!)
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
Run it!
Click the green RunI have no idea what this means button. Look at the ShellAn alternative name for the interface of an interpreter. (the bottom window). You should see your message! If you don't then check your code carefully.
4
Write about it
Write about what you have learnt on your lesson sheet.
Part B: Breaking and Fixing (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. Let's make some syntax errors on purpose! For each step, try it, read the error message in the shell, and then fix it before moving on.
1
The Typo Error
Change
print
to prnt
. Run the code. See the SyntaxError
message? The computer doesn't know a command called prnt
. Fix it back to print and run it again.2
The Missing Quotes Error
Remove the quotation marks "" from around your text inside the brackets. Run the code. The computer will get very confused! This is because it thinks your name is a command or a variable, not a string. Put the quotes back to fix it and run it again.
3
Write about it
Write about what you have learnt on your lesson sheet.
Outcome: I can write, save, and run a Python program. I can also identify and fix a simple syntax error.

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