Skip to main content

Unit 2 · Python mode... Activate! · Lesson 23 of 57

Project: Amer's Account Setup

Project time!

Amer is making a new account. Again. (He forgot the password to the last one. It was amer123.)

This time, he wants a program that comes up with a password for him. The problem? Amer's idea of a "good" password is just his name and his birth year smushed together.

Your job is to build his program anyway, and then roast him for it.

What it should do

  1. Make a function called make_password that takes a name and a year, and returns them glued together. So make_password("Amer", 2010) should give back "Amer2010".
  2. Ask for a name with input().
  3. Ask for a birth year with input(), and turn it into a number.
  4. Use f-strings to print these two lines (using 2026 - year for the age, like before):
Hey Amer! You're 16 years old.
Please don't use Amer2010 as your password.

That's what it prints if you type Amer and 2010.

Everything you need is in this unit: functions, return, input(), int(), and f-strings. If you get stuck, go back and peek. That's what I'd do!

Build Amer's (terrible) password program!

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.