Posts Categorized: Tutorials

Python: Username Generator

The previous exercise¬†used random to choose a random number. In this exercise (also available as a PDF) we choose random words from lists to create custom usernames. This exercise introduces the following concepts: String Manipulation Lists For Loops Type the code below into a new repl.it or use an Python IDE (code editor) such as… Read more »

Python : Roll the Dice Multiple Times

We would like to expand the code from the previous exercise to allow multiple rolls of the dice without having to re-run the program each time. This exercise introduces the following concepts: Whitespace String Manipulation Functions While Loops If Control Statements To your existing ‘Roll the Dice’ code add the lines below: import random run_prog… Read more »

Python : Roll the Dice

This short exercise will cover topics relevant to GCSE computing including: Variables Data Types Random Numbers Log in (or register) at https://repl.it Create a ‘New Repl’ Then choose ‘Python 3’ as the language Type the following code into the left pane: import random random_number = random.randint(1,6) print(“The dice rolled: ” + str(random_number)) Then click the… Read more »

Python : Hello World

This short exercise will cover topics relevant to GCSE computing including: Variables Data Types User Input Log in (or register) at https://repl.it Create a ‘New Repl’ Then choose ‘Python 3’ as the language Type the following code into the left pane: name = input(“What is your name ?”) print(“Hello ” + name) Then click the… Read more »

Python Programming Without Installing

repl.it

If you would like to try Python programming without installing Python or an IDE on your own computer you can log in to repl.it, type your code and run it – all from within your web browser.