All lessons

Strings & booleans · step 8 of 22

Lab: username generator

Sign in if you want this lab saved to your progress.

String surgery

Every member needs a clean username built from their details.

Given for you

  • first_name, last_name, member_since
  • display_name — with stray spaces and messy capitals

Build a variable username: the first three letters of the first name + the first three letters of the last name + the year, all lowercase. For Ada Lovelace joining in 2026 that is adalov2026.

Then print three lines:

  1. the username
  2. Welcome, <username>!
  3. the display name tidied up: spaces stripped, written in title case, all spaces removed → AdaLovelace

Build it

Fill in the code, then run it. Every check has to pass for the lab to count.

lab-username-generator.py

Given for you

first_name = "Ada"
last_name = "LOVELACE"
member_since = 2026
display_name = "  ada lovelace  "