(Find the number of years and days) Write a program that prompts the user to enter the minutes (e.g., 1 billion), and displays the number of years and days for the minutes. For simplicity, assume a year has 365 days. Here is a sample run:
Enter the number of minutes: 1000000000
1000000000 minutes is approximately 1902 years and 214 days
The following program that prompts the user to enter the minutes (e.g., 1 billion), and displays the number of years and days for the minutes:
CODE WITH COMMENTS:
Minutes=int(input("Enter the number of minutes:")) #taking input number os minutes
total_number_of_days = Minutes//(60*24) #dividing minutes with 24*60 gives number_of_days
number_of_years = total_number_of_days//365 # dividing number_of_days with 365 gives number_of_years
leftover_number_of_days = total_number_of_days % 365 #modulus of total_number_of_days with 365 gives leftover_number_of_days
print(Minutes,"minutes is approximately",number_of_years,"years and",leftover_number_of_days,"days") #diaplay final result
OUTPUT:
Enter the number of minutes:1000000000
1000000000 minutes is approximately 1902 years and 214 days
Enter the number of minutes:173942936
173942936 minutes is approximately 330 years and 343 days