Try Python Coding Online
On this page, you can try out some of the programs in Coding for Beginners using Python and test your own programs. The programs run in your browser in windows called Trinkets and you don’t need to download or install any software.
Scroll down to view sample programs from Coding for Beginners using Python – or go to the bottom of the page for a Trinket where you can run your own code.
Click or tap the ‘Run’ arrow ➤ to see the code in action. You can edit the code, too, but you won’t be able to save your changes.
Guessing game
This program generates a random number between 1 and 20 for you to guess. Try editing the code to change the range of numbers. For more about this program see page 30 in Coding for Beginners Using Python.
A game of consequences
This program generates silly stories, like the party game ‘Consequences’. It uses variables stored as lists – see pages 36-39 in Coding for Beginners Using Python. Each time you run the program you’ll get a different story. Try changing some of the variables to generate different stories.
Spy messages
Spies use encryption to scramble the letters in their messages. This ‘Caesar Cipher’ program takes your message and shifts each letter along the alphabet a certain number of places, depending on the number you enter in the code. See pages 42-45 for more about this program – and how to decrypt your messages.
Try your own code
You can try your own Python programs in this Trinket window – or any of the programs up to page 45 in Coding for Beginners Using Python. You can download the code for the programs at the Usborne Quicklinks. (Programs after page 46 use code that is not supported by this Trinket window.)
Usborne Quicklinks
Download the code for programs in Coding for Beginners Using Python, and for links to lots of other useful resources