GRAND ASSIGNMENT - 1 Days Conversion
Days Conversion
Given a number of days (N) as input, write a program to convert N to years (Y), weeks (W), and days (D).
Input
The input will be a single line containing a positive integer (N).
Output
The output should be a single line containing years, weeks, days values separated by spaces.
Explanation
For example, if the given number of days (N) is 1329.
1329 = 365*3 + 33*7 + 3
So the output is 3 years 33 weeks 3 days
Input
The input will be a single line containing a positive integer (N).
Output
The output should be a single line containing years, weeks, days values separated by spaces.
Explanation
For example, if the given number of days (N) is 1329.
1329 = 365*3 + 33*7 + 3
So the output is 3 years 33 weeks 3 days
Sample Input 1Sample Output 1
1329
3 years 33 weeks 3 days
Sample Input 2Sample Output 2
960
2 years 32 weeks 6 days
N = int(input()) years = int(N/365) remaining_days = N - (years * 365) weeks = int(remaining_days/7) remaining_days = remaining_days-(weeks*7) days = remaining_days print ((str(years) +" years ") +(str(weeks) + " weeks ")+(str(days) + " days"))
Comments
Post a Comment