This Python program receives a person's age in years, months, and days.
It converts the total age into minutes and seconds using the following assumptions:
- Each year has 365.25 days
- Each month has 30 days
- Each day has 24 hours, 60 minutes per hour, and 60 seconds per minute
def age_to_minutes_seconds(years: int, months: int, days: int) -> tuple[int, int]:
total_days = years * 365.25 + months * 30 + days
total_minutes = int(total_days * 24 * 60)
total_seconds = int(total_days * 24 * 60 * 60)
return total_minutes, total_seconds
# Get input from user
years = int(input("Enter age in years: "))
months = int(input("Enter additional months: "))
days = int(input("Enter additional days: "))
minutes, seconds = age_to_minutes_seconds(years, months, days)
print(f"Total age in minutes: {minutes}")
print(f"Total age in seconds: {seconds}")
Total age in minutes: 592560
Total age in seconds: 35553600
- The user enters age in years, months, and days
- The program calculates total days using the given assumptions
- It multiplies total days by 1440 to get minutes, and by 86400 to get seconds
- The result is printed clearly