Answer to Question #232804 in Python for Swapna

Question #232804
Given N number of days as input,write a progrme to convert N number of days to years (Y),weeks (W) and days (D).
Note:take 1 year=365days
1
Expert's answer
2021-09-03T03:51:43-0400
days = int(input("Enter number of days: "))
years = days // 365
if years > 0:
    print(years, "years", end = " ")
weeks = (days - years * 365) // 7
if weeks > 0:
    print(weeks, "weeks", end = " ")
newDays = days - years * 365 - weeks * 7
if newDays > 0:
    print(newDays, "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