Challenge: Birthday Calculator
Explore how to interact with users in Python by writing a program that asks for the birth year, converts the input into a number, and calculates the age based on the current year. This lesson strengthens your skills with variables, data types, and basic arithmetic in Python.
We'll cover the following...
Python programs can ask the user questions and use their answers.
You can do this using the input() function.
Whatever the user types is returned as text, even if it looks like a number.
Your task:
Ask the user what year they were born
Convert their answer into a number
Calculate their age using the current year
Print a friendly message showing their age
💡 Things to keep in mind:
You’ll need to store the user’s input in a variable
To do math, text must be converted into a number
Age is calculated by subtracting the birth year from the current year
You can assume the current year is 2025.
When you click Run, your program should ask a question and then display the user’s age.
# Write your code here.