# Simple password rules

This a problem set for you to work through [1]

This is a problem set. Some of these are easy, others are far more difficult. The purpose of these problems sets are to HELP YOU THINK THROUGH problems. The solution is at the bottom of this page, but please don't look at it until you have tried (and failed) at least three or four times.

## The Problem

This problem is designed to test your skill and knowledge of strings, specifically your knowledge and understanding of testing if strings are a certain length, contain numbers, etc...

Please write a simple program that asks the user to enter a password and confirm a password. The password must be at least 8 characters long, have one uppercase character, and have at least one symbol. Of course, the original password must match the confirmation password. :-)

## Some Code to Get You Started

```# this is my password rules application

1. have 8 characters of more
2. have at least one number
3. have at least one symbol

''')

# the first check will be to see if the passwords match.

# let's see if the password is at least 8 characters. I wonder how we would do that?
#
else:
print("let's see if the password is at least 8 characters.")
```

## Take This Farther

This simple program is very useful, and it is likely that you have used a function when you register for a web service.

• password rules should be customizable! Make a configuration form that asks the user how long the password should be, how many uppercase characters it should have, and how many symbols, and then apply those rules to your password form, above.

## How you will be assessed

Every problem set is a formative assignment. Please click here to see how you will be graded

## One Possible Solution

Click the expand link to see one possible solution, but NOT before you have tried and failed!

```# this is my password rules application

1. have 8 characters of more
2. have at least one number
3. have at least one symbol

''')

else:
if len(user_password) < 8:
print("Error: Your password must be at least 8 characters long. ")
else:
print("Length is ok. Now lets now check for numbers.")
if user_password.isalpha() == True:
print("Error: you must have at least one number in your password.")
else:
print("let's see if there is a character in there.")
if user_password.isalnum() == True:
print("Error: You need punctuation marks")
else:
print("You have passed all our required tests, and have created a valid password.")
```