Practice Python

Beginner Python exercises

06 June 2014

Password Generator Solutions

Exercise 16

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:

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.

And here is another, using internal Python functions:


comments powered by Disqus