Answer to Question #218773 in Python for Ravichandrasekhar

Question #218773

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: Take 1 year = 365 days.  

Input

The input contains single integer

N.Output

Print space-separated integers

Y, W and D.Explanation

Given

N = 1329. The value can be written as 1329 = 3 years + 33 weeks + 3 daysSo the output should be

3
33
3


N=0


0
0
0
1
Expert's answer
2021-07-21T01:55:35-0400
N = int(input("Enter number of days: "))
Y = N // 365
if Y > 0:
    print(Y, "Years", end = " ")
W = (N - Y * 365) // 7
if W > 0:
    print(W, "Weeks", end = " ")
D = N - Y * 365 - W * 7
if D > 0:
    print(D, "days")
else:
    print("")

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS