It’s important to protect your personal information online. Learn what makes a good password and create a program to generate passwords for you. The passwords will be random, so no one will be able to guess them!
A programme that generates passwords.
Adding text to a string variable
Using the random.choice() function
Using a for loop
Asking for user input
A computer or tablet capable of accessing the internet.
Use this link to go to the Code Club online project: projects.raspberrypi.org/en/projects/password-generator and follow each step in the project.
Challenge 1: Creating a better password.
Challenge 2: Using numbers and punctuation - adding text to a string variable.
Challenge 3: A longer password - modifying the number of times a random character is chosen.
Challenge 4: Choosing the number of passwords - using a variable to specify the number of passwords required.
Use this link to go to the Password Picket trinket: trinket.io/python/92af59141b and click Remix.
The code imports data from files that contain adjectives, colours and nouns. Add your own ideas for adjectives, colours and nouns to the files.
The random.choice() function picks an adjective, colour, noun and a punction character at random. The random.randrange() function picks a number at random.
The variable password is set equal to the variables adjective + colour + noun + character + str(number). The number variable must be transformed from an integer to a string so that it can be combined with the other string variables.
If you don't like the password chosen you can generate another. Putting the code in a while loop means that you can run through the password generation again if the user selects 'yes' or stop the code if the user selects 'no'.