Skip to main content

27 February 2023

Moving pupils from Scratch to Python

Javier De Las Heras profile image
Written by

Javier De Las Heras

As we all know, block-based programming languages such as Scratch make it simple to learn and teach programming. However, this is good for KS2 and year 7 after which, it’s time to move on to a text-based programming language such as Python or JavaScript. We will focus here on Python as 90% plus schools use it.

The main obstacle to learn text-based languages is understanding the specific syntax needed. Pupils at this stage tend to make many syntax errors, and this frustrates them and demotivates them. One thing that we can do as teachers at this stage is to show the parallels and differences between Scratch and Python syntax using an easy-to-use online IDE such as Trinket ( ). Let’s look at some examples of parallel programming activities:

- Inputs/Outputs: Show a simple input and output Scratch program and ask pupils to predict what will happen (Oracy opportunity); then show them in Python.

- Variables: Remind them how a variable is created in Scratch before you model it in Python (Pair programming opportunity).

- IF statements: Provide for them a Scratch program that shows different outputs depending on an input, then provide the code in Python and ask them to discuss the differences (Oracy opportunity).

- For loops: Model how to create a loop to output the numbers 1 – 10 in Scratch, then model a simple counter-controlled loop in Python (Debugging opportunity).

- While loops: Demonstrate in Scratch how to add numbers inputted until they input 0, then it outputs the total with a message. Demonstrate the same conditional loop in Python (Pair programming and debugging opportunity).

You can provide the following challenges for pupils to complete in pairs or individually using Python:

- Input/Output/Variable challenge: Show them a Scratch program that adds 2 inputs and outputs the result.

- IF statements: Show them a Scratch program that outputs a grade based on a percentage.

- For loops: Show them a Scratch program that accepts a message and an integer d outputs the message the specified integer inputted.

- While loops: Show them a Scratch program that simulates a log-in screen and keep asking for the password and/or username while it is incorrect.

There is also the possibility if you have micro:bit devices to use the micro:bit editor ( ) to further enhance their experiences by using Physical computing. As well as seeing their output of the program on the on-screen emulator, the pupils can also download the .hex file onto a physical micro:bit. There are loads of example programs and support online through The CAS and NCCE resources for free.

Finally, there is EduBlocks to transition smoothly from Scratch-style coding to text-based programming. EduBlocks ( ) is an online Python block editor. Each block has a line of Python code on it, rather than a single word or verbal command. This way, pupils will start to read Python code while using the blocks. After a while, they will be ready to move to atext-based IDE like Idle, Trinket, Thonny, etc.

Do you transition from block to text-based programming in a different way? Please share.


Please login to post a comment

Laurentiu Stelea
01/06/2023 12:22

Dear all,
I used Edublocks and transition seems to be very smooth

Adrienne Tough
18/05/2023 18:40

It is free to use yes, not sure about the sign up process as I never set up accounts

Gussie Morley
18/05/2023 15:19

Is Edublocks free to use? Can you sign pupils up easily?

Michael Borcherds
04/05/2023 08:47

Pytch looks good for the next step after Scratch

(I haven’t really tried it… but I’m working with the author on a similar project coming soon…)

Graham Hastings
17/04/2023 18:10

Chatgpt is an excellent tool - the learners can decompose a problem that the teacher has set them, design an algorithm, get chatgpt to write the code and then hack it to experiment and adapt it to explore how it can be generalised.
Removes all the frustration that beginners experience from endless syntax errors. The micro:bit Python Editor will allow them to download and test their code on the micro:bit if they so wish.

Olubunmi Opeagbe
02/03/2023 09:02

I agreed with Arlene

Mark Weddell
28/02/2023 20:12

The work on this could and probably should start in Primary.

Phil Bagge’s new book demonstrates pupils writing code on paper, planning algorithms and introducing some of the concepts of syntax that will be needed later.

In my junior school lesson I introduce the idea of:

  • one instruction per line
  • indentation in loops and selection statements (the blocks move the instructions across automatically!)
  • brackets for arguments (e.g. where you have a white space for a value in scratch)
  • my blocks uses the define terminology

When planning Scratch code for a project or as a starter with year 5 & 6, I often get them to write out a quick algorithm such as:

repeat (4):
  move (50) steps
  turn right (90)


def square (length):
  repeat (4):
     forward (length)
     right (90)

call square (70)

Here’s one of Phil’s from twitter

Pete Dring
28/02/2023 19:59

Sorry - yes - it does that. If you surround your code with three back ticks (the button to the left of 1 on a UK keyboard) on the lines above and below then it will format your text as code and preserve whitespace.
Phil Bagge’s books are excellent - thanks for the recommendation (other booksellers are definitely available :slight_smile: )

Mark Weddell
28/02/2023 17:46

And the forum has removed all my indentation and extra lines.

B Simmons
28/02/2023 15:52

It is an also good for pupils aspirations if you talk about how Josh was only 12 when he started developing it etc.

B Simmons
28/02/2023 15:48

Haven’t read the article, but just to say.
MakeCode is another place to use, (with micro:bit, cpx, Minecraft edu, mindstorms EV3…) physical-ish computing with blocks and can switch to python at the same time.

Pete Dring
27/02/2023 20:03

I agree Adrienne. Thanks Javier - great blog. There’s a really good resource by Dave Lowe with some side by side examples of scratch, edublocks and python: great for KS2 and KS3.

Adrienne Tough
27/02/2023 18:16

Edublocks is a great bridge between the two too.