Years, Weeks & Days
Given N number of days as input, write a program to convert N. number of days to years (Y)
weeks (W) and days (D)
Note:
The input contains single integer N
Print space-separated integers Y, W and D
Given N = 1329
The value can be written as
1329 = 3 years + 33 weeks + 3 days
So the output should be
3 33 3
.
Sample Input 1
1329
Sample Output 1
3
33
3
Sample Input 2
Sample Output 2
import sys
# Accept input as argument; if argument is not specified, read from cmdline
try:
days = int(sys.argv[1])
except:
days = int(input())
y = days // 365
w = (days % 365) // 7
d = (days % 365) % 7
print(y)
print(w)
print(d)
Comments
Leave a comment