Answer to Question #282285 in Python for santosh

Question #282285

given a number of days(N) as input, write a programme to convert N to years(Y),weeks(W)and days(D)


1
Expert's answer
2021-12-24T01:20:31-0500
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