Password Generator


It’s important to protect your personal information online, and in this project you’ll create a program to generate passwords for you.

The passwords will be random, so no one will be able to guess them!

Additional information for club leaders

If you need to print this project, please use the Printer friendly version.

Club leader notes


In this project, children will learn what makes a good password, and how to make a program that creates randomly generated passwords.

This project has been written for Safer Internet Day 2017, which is on 7th February 2017. The aim of Safer Internet Day is to promote the safe and responsible use of technology for young people. For more information visit where you’ll find an education pack for 7-11 year-olds containing additional resources.

Online Resources

This project uses Python 3. We recommend using Trinket to write Python online. This project contains the following Trinkets:

There is also a trinket containing the finished project:

Offline Resources

This project can be completed offline if preferred.

You can find the completed project in the ‘Volunteer Resources’ section, which contains:

  • password-creator-finished/

(All of the resources above are also downloadable as project and volunteer .zip files.)

Learning Objectives

  • Repetition;
  • The random.choice() method;

This project covers elements from the following strands of the Raspberry Pi Digital Making Curriculum:


  • “Creating a better password” – using to create secure passwords.
  • “Using numbers and punctuation” – adding text to a string variable, giving a wider choice of random characters.
  • “A longer password” – modifying the number of times a random character is chosen.
  • “Choosing the number of passwords” – using a variable to specify the number of passwords required.