Question: Write a password generator in Python. Be creative with how you generate passwords - strong passwords have a mix of lowercase letters, uppercase letters, numbers,

Write a password generator in Python. Be creative with how you generate passwords - strong passwords have a mix of lowercase letters, uppercase letters, numbers, and symbols. The passwords should be random, generating a new password every time the user asks for a new password. Include your run-time code in a main method.

Extra:

  • Ask the user how strong they want their password to be. For weak passwords, pick a word or two from a list.

You will need to use Pythons Random Number generator. Use the sample code below.

This is your first exposure to using Python code that somebody else wrote. In Python, these formally-distributed code packages are called modules. The thing we want from a module in this exercise is the ability to generate random numbers. This comes from the random module.

To use a module, at the top of your file, type

import random

This means you are allowing your Python program to use a module called random in the rest of your code.

To use it (and generate a random integer), now type:

a = random.randint(2, 6)

Once you run this program, the variable a will have a random integer that the computer made for you, between 2 and 6 (including 2 and 6).

There are many ways you can generate random numbers - integers, decimals, and much more.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!