DEV Community 👩‍💻👨‍💻

Daniel Marlow
Daniel Marlow

Posted on • Updated on

Lockdown Programming Challenges: 2. Password Generator

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.


Present a number of password possibilities to the user.

Try different mechanisms to randomly generate characters.

Top comments (2)

shubh2346 profile image

import random

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

length =16
pass ="".join(random.sample(all,length))

drm317 profile image
Daniel Marlow Author


🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.