Quick actions

cmd+k|ctrl+k

Navigation

Languages

type_conversion

Snippet info

Language

Python

Visibility

public

Author

bridgetzhou16

Created

2024-12-27T21:59:48.160044Z

Updated

2024-12-27T22:18:39.021238Z

#have user input their birth year, and then have the program return "You are ___ years old"

birth_year = int(input('What year were you born in?'))

from datetime import date
current_date = date.today()
current_year = current_date.year

age = current_year-birth_year

print(f'\nYou are {age} years old.')
INFO