AssignmentsWeek 01 · FoundationsProfile card printer
wk01.p1Practice exerciseWeek 01 · FoundationsOpen · due in week 1

Profile card printer

Ask the user four questions about themselves, then print a clean five-line profile card. Get comfortable with input, types, and conversions.

What you'll build

Ask the user four questions about themselves, then print a clean five-line profile card. Get comfortable with input, types, and conversions.

Requirements

The must-do parts. If any are missing, we'll ask you to take another pass.

  1. Ask the user for their name, city, favourite food, and year of birth using input().
  2. Convert the year of birth into an integer with int() and calculate their age (use 2026 - year).
  3. Print a profile card with at least five lines — name, city, favourite food, age, and a closing line.
  4. Add one comment in your code explaining what the conversion line does.
Bonus, if you're feeling brave
  • Ask for height in metres (use float() for the conversion) and add it to the card.
  • Make the card look nicer with a row of dashes above and below.

Examples

What your program should look like when it runs. Lines starting with $ are typed by you; the rest is your program.

Example run
$ python profile_card.py
Your name: Adwoa
Which city do you live in? Kumasi
Favourite food: jollof
Year you were born: 2002

------------------------------
Name: Adwoa
City: Kumasi
Favourite food: jollof
Age (in 2026): 24
Welcome to PySprout.
------------------------------

Where to start

Copy this scaffold into a new file. You don't have to use it — it's just a friendly nudge.

profile_card.py
# Ask four questions, then print a profile card.

name = input("Your name: ")
city = input("Which city do you live in? ")
food = input("Favourite food: ")
year_text = input("Year you were born: ")
# TODO: turn year_text into an integer and calculate age
year = int(year_text)
age = 2026 - year

# TODO: print a clean, five-line card using all four answers

How we'll grade it

Four checks, four points. Three or above is passing — we'll ask you to revise anything we can't tick.

CheckWhat we look forPt
It runsStarts cleanly. Asks all four questions in order.1
Uses inputsEvery printed line uses something the user actually typed.1
Uses types rightYear is converted to int. The age math actually works.1
Readable outputThe card is easy to scan — no walls of text glued together.1
Ready?
Hand it in
You can submit a draft and revise later if you're not done.
Begin submission →