01: Python: Output

This activity is designed to help you learn how to use python to write a program that displays an output.

Write a program that displays an output
Python output: Write a program that displays an output


Page 1: Intro

Page 2: The theory: learn what you need to know as fast as possible.

Page 3: Try it: try out and adapt some working python code snippets.

Page 4: Debug it: Learn how to find and fix common mistakes.

Page 5: Extend it: Choose a project idea to use your newfound python skills.

Create.withcode.uk: 5 new features to simplify writing python code online

Create.withcode.uk is a free tool that lets you write, run, debug and share python code online. I teach Computing in York, UK and it started out as a quick tool that I could use to share code with my students when explaining and debugging with them.

The free online python interpreter lets you simulate a Raspberry PI GPIO connector, a BBC micro:bit as well as running most ‘normal’ python programs from beginner to GCSE standard.

This slideshow requires JavaScript.

It’s not designed to replace a full python Integrated Development Environment such as IDLE or Mu but it is designed to make it as easy as possible for students to write, run, debug and share code on any device, without needing to install any special software.

Every now and then some students or teachers make some really helpful suggestions on how create.withcode.uk can be improved and I’ve finally got round to implementing a few of them. Thank you to everyone who’s send in some feedback!

Here are 5 features that I’ve just finished working on to make it easier for teachers and students to enjoy learning python:

1: Easier to share

Share python code online
Share python code online

Create.withcode.uk was designed so that students in a classroom could easily copy down a relatively short web link to get to code that has just been demonstrated at the front of class.

The links it generates avoid any ambiguous characters like 0 / O or I / 1. For those that don’t want to copy a link off the screen, there’s been an option to share as a QR code or post on twitter for a while, but I’ve added in social share buttons so you can quickly share your code to access it again later

2: Easier to print

print python code online
Print python code online

The main reason why people use create.withcode.uk is to write, run, debug or share code, but occasionally it’s useful for students to generate printouts of their code.

This was a bit of a pain before as you had to take screenshots of each section but now I’ve made it so that code flows nicely onto as many pages as are required with full line numbers, headers, footers and syntax highlighting.

For teachers and students who still like to annotate code on paper, this should hopefully make your life a little bit easier. Or for teachers who use tablets, you can generate PDFs and annotate them digitally.

3: Easier to save

Save python code online
Save python code online

Right from the start of create.withcode.uk I wanted it to be really easy for students to get writing and sharing code, so you’ve never needed to create student accounts. Each time you save, you get a new URL.

This is quick and easy, but if you’re working on a big project over a period of time, it’s annoying to keep track of all the different links you generate.

I’ve now added a feature so that you can log in using a Google account so that you can keep updating code that you’ve previously saved.

This means that you can share a link to your code and not have to worry about getting it perfect before embedding it elsewhere: you can make small (or large) change to your code without changing the URL used to access it.

There are now three ways to save, all of which you can get to via the share button in the tool bar, or by using their keyboard shortcuts:

Ctrl + S  does what it always used to: saves your python code to a new, unique URL that is publicly available for anyone else to view. If you’re not logged in, you may have to complete one of those irritating captcha things to prove you’re human first time you save. This prevents the service from being abused by bots.

Ctrl + Shift + S  saves your code overwriting what was previously saved at the current URL. You need to be logged in for this to work and you must be currently viewing some code that you saved whilst also logged in on the same account.

Ctrl + Alt + S  downloads a copy of the file you’re currently viewing so that you can save it or run it offline.

You can log in using any Google account, which will then show your Google account profile picture as an additional button in the tool bar in the bottom right of the screen. Clicking on this button will show your recently saved files.

4: Easier to embed

Embed python code online
Embed python code online

A little while ago I published a free plugin for wordpress sites that lets you easily embed python code into your website or blog.

Now that you can login and save code multiple times to the same URL, it’s much easier to maintain python code that you’ve got embedded in a blog.

Before, if you spotted a bug in your code that you’d embedded on another website, you had to fix it, save it to a new URL and update all of the links wherever you published your code. Now, you – and only you – can edit code that you’ve previously saved without having to change any embed codes.

This feature is designed to save time when teachers share code to VLEs, blogs or Google Classroom.

5: Easier to debug

Debug python online
Debug python online

As well as being able to run your whole python code by pressing Ctrl + Enter  you can also debug your programs by pressing Ctrl + .  to step through one line at a time.

I’ve made a few changes in response to feedback to try to make debugging python code a little bit simpler:

Instead of the program output appearing in the middle of the screen on top of your code, it now appears on the right hand side of the screen so you should be able to see your code and the output side by side. I was torn whether to make the code window just fit on the left side of the screen but decided to keep it the full width of the screen. The code output window can be dragged around and you can even set it to be partially transparent in the options window by pressing Ctrl + O  or clicking on the settings tool button.

I’ve also cleaned up the white box on the right of the debug window that shows all global variables whilst you step through your code line by line. You can now show / hide this window using the red arrows. Hovering your mouse over any variable will make it’s value increase in size. I use this feature when explaining how variables change when demonstrating code in front of a class.

Finally, I’ve also worked out how to display local variables as well as global variables so you can step through code inside a function and see the types and values stored in all local variables as well as all the global variables.


If you have any feedback, ideas or suggestions on how I can make create.withcode.uk a useful tool to help people enjoy learning how to write, run, debug and share python code then I’d love to hear from you. I’d be less happy (but just as appreciative) to hear from you if you spot something I’ve broken that needs fixing.

Please bear in mind that I’m a full time teacher with small children of my own so I can’t promise I’ll be able to respond to all suggestions promptly (or at all…) I will however promise that I’ll always try to keep create.withcode.uk running as a free tool aimed at making learning python programming a little bit easier for teachers and students.




Recycle 3D update: Creating your own 3d printer filament

Recycle 3D update: Creating your own 3d printer filament

Back in March this year, Fulford School STEM club launched Recycle 3D: a crowd-funding project to start turning waste plastic drinking bottles into 3d printed artwork.

Thanks to the generosity of parents, teachers and local businesses we raised enough money to buy all of the equipment we needed to get started, including:
  • 3D printer kit: students can put together the parts to create a printer capable of printing objects in multiple colours
  • 3D print filament extruder: a machine that melts down plastic pellets and turns them into the filament that gets fed into the 3d printer
  • Shredder: a microcut paper shredder that – given a bit of persuasion – should be able to shred drinks bottles

Thanks to some really kind support from the PTA and a grant from the Institute of Physics, we were able to smash our funding target of £1,500 to raise £1,676

Recycle3D STEM Club poster
Recycle3D STEM Club poster to recruit more Y7 and Y8 girls.

The kit has now arrived and so in yesterday’s STEM club we started assembling the 3d filament extruder.

The biggest slice of our budget went on a Noztek Pro Filament Extruder which takes plastic pellets, heats them up to melting point then shoves them through a nozzle to form a thin strand of plastic that can then be used in a 3d printer:


Please note: photos of students are only included here if students and parents have given consent. Please contact me if you have any questions or concerns.

Before we tried the extruder with shredded plastic drinks bottles we wanted to try it out with some ABS plastic pellets that came with the Noztek Pro.

Results were positive: the ABS plastic pellets we used had a melting point of between 195 and 200 degrees Celsius so we set the temperature to 197 degrees. Before long, a steady stream of plastic was coming out of the nozzle.

Sadly, the Noztek Pro doesn’t come with a spool to collect the filament. We used a spare wire spool to wind the plastic filament around, but we found that turning the spool at slightly different speeds affected the thickness of the filament.

Lessons learnt:

  • The Noztek Pro is a great piece of kit that works well, at least with small ABS pellets.
  • We could do with a spool that turned slowly to collect all of the filament that is extruded. A speed adjustable stepper motor rigged up to an old 3d printer filament spool and mounted to the end of the Noztek Pro would be idea.


Next steps:

The next thing to do is to start assembling the 3d printer. We also need to work out how to safely disassemble the paper shredder so that we can put plastic bottles through. I’ve tried it to make sure it can cope, but I don’t fancy students being able to shred their fingers…

The students who come along to STEM club are brilliant – really keen and motivated. We currently have loads more boys than girls. Part of the reason for establishing STEM club was to recruit more girls into Computer Science and Design & Technology so I want to get form tutors involved in recruiting girls who might be interested in getting involved.