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.
A beginner’s guide to coding using Python, one of the most popular computer languages. Step-by-step instructions show how to get started and write a simple program. New commands are introduced with examples and colourful pictures so by the end of the book, readers can code games, drawings and more. Includes extra help and downloads online.
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.
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.
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.
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 website. (Programs after page 46 use code that is not supported by this Trinket window.)