Skip to content

Latest commit

 

History

History
25 lines (15 loc) · 1.16 KB

File metadata and controls

25 lines (15 loc) · 1.16 KB
layout post
number 16
categories
solution

{% include solution_header.md number=page.number %}

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 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.

Sample solution

There are so many possible solutions to this exercise, really depending on how far you want to challenge yourself. The field of security, especially as it relates to computing, is an ever-growing field with countless experts, theories, principles, and more.

The sample solution here is one possible way to answer the question: it generates a string of random characters. It is clean, simple, and elegant.

<script src="https://gist.github.com/prgrm/a85d2da1a1be791bfdd6.js"></script>

And here is another, using internal Python functions:

<script src="https://gist.github.com/anonymous/4a752288b785312ca840.js"></script>