In: Computer Science
Write a python program that will ask the user to enter any number of days. The program reads the number of days from the user, and returns how many years, months, and days are there in the given number of days.
Your program should prompt the user to:
Enter the number of days : 1152
The user types number of days (1152 above, for example) and hit
enter key.
The program then will print:
3 years
1 months
27 days
Another example of the program input and output:
Enter the number of days : 300000
821 years
11 months
5 days
Notice the indentation of the output
Marking rubrics of Question 1:
1 mark for reading an input.
1 mark for finding number of years
1 mark for finding number of months
1 mark for finding number of days
1 mark for coding style
Full 1 mark for each correct answer, and ½ mark for partially correct answer.
please pay attention to output format
n = int(input('Enter the number of days : ')) years = n // 365 n = n - 365 * years months = n // 30 n = n - 30 * months days = n print(years, 'years') print(months, 'months') print(days, 'days')
************************************************** Thanks for your question. We try our best to help you with detailed answers, But in any case, if you need any modification or have a query/issue with respect to above answer, Please ask that in the comment section. We will surely try to address your query ASAP and resolve the issue.
Please consider providing a thumbs up to this question if it helps you. by Doing that, You will help other students, who are facing similar issue.