Answer to Question #225379 in Python for sayi

Question #225379

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:

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 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





1
Expert's answer
2021-08-11T14:18:18-0400
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)

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