given a number of days(N) as input, write a programme to convert N to years(Y),weeks(W)and days(D)
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("")
Comments
Leave a comment