Lockdown Programming Challenges: 2. Password Generator
Daniel Marlow

Daniel Marlow @drm317

Location:
Southampton, UK
Joined:
Jan 19, 2019

Lockdown Programming Challenges: 2. Password Generator

Publish Date: Apr 4 '20
1 2

This is the second in the series of lockdown programming challenges I'm going to post over the next few weeks. Remember the aim is to learn something new, try a new programming language, brush up on your clean coding skills or just while away the hours under lockdown. Feel free to post your efforts in the comments.

In the first challenge we looked at password complexity. For this second challenge we're going to create a password generator.

Challenge 2: Create a Password Generator

Create a program that generates a password. Ask the user to enter the following:

  • The minimum total number of characters
  • The minimum number of special characters (&*%&^$ etc)
  • The minimum number of uppercase letters
  • The minimum number of lowercase letters
  • The minimum number of digits

Generate a password that follows these rules specified by the user.

Display your generated password to the user on the screen.

Advanced

Present a number of password possibilities to the user.

Try different mechanisms to randomly generate characters.

Comments 2 total

  • shubh2346
    shubh2346Jul 2, 2020

    import random

    lower ="abcdefghijklmnopqrstuvwxyz"
    upper ="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    numbers ="0123456789"
    symboles ="[]\•@#$&()"

    all=lower+upper+numbers+symboles
    length =16
    pass ="".join(random.sample(all,length))
    print(pass)

Add comment