Unit 3 · Decisions, Decisions · Lesson 31 of 57
Project: Password Bouncer
Project time!
Amer keeps signing up for things with terrible passwords, so we're building a bouncer that rates them before he's allowed to use one.
What it should do
Make a function called rate_password that takes a password and returns one of these strings:
The Amer rule beats everything else. Even amerisaverysecurepassword gets "Nice try, Amer."
One more new trick: in asks whether one string is inside another:
print("amer" in "amer123")
print("amer" in "zain123")
True
False
Then, under your function:
- Ask for a password with
input() - Print what
rate_passwordgives back
Build the password bouncer!
Python exercise
Write the program in an editor next to the lesson, run it, and have it checked automatically. Create a free account to do this part.
Do this lesson for real
With a free account you get the terminals, challenges and checks that go with the lessons in Intro to Python, and your progress is saved as you go. CyberAcad is a 501(c)(3) nonprofit, so there is nothing to pay.