1def show_time(time):
2 time = int(time)
3 day = time // (24 * 3600)
4 time = time % (24 * 3600)
5 hour = time // 3600
6 time %= 3600
7 minutes = time // 60
8 time %= 60
9 seconds = time
10 if day != 0:
11 return "%dD %dH %dM %dS" % (day, hour, minutes, seconds)
12 elif day == 0 and hour != 0:
13 return "%dH %dM %dS" % (hour, minutes, seconds)
14 elif day == 0 and hour == 0 and minutes != 0:
15 return "%dM %dS" % (minutes, seconds)
16 else:
17 return "%dS" % (seconds)
18
19print(show_time(12345))
1days = input("Number of days\n")
2seconds = days * 24 * 60 * 60 # your answer :)
3print(seconds) # you can check this by printing, if you want...