158k views
4 votes
write a program that asks the user to enter a number of seconds and then prints the same amount of time in days, hours, minutes, and seconds.

User Fvrab
by
5.2k points

1 Answer

4 votes

inp = int(input("Enter amount of seconds: "))

for i in range(4):

idx = (39630*((i+1)**2))-(201690*(i+1))+248460

calc = str(int(inp/idx))+" days," if (i+1==1) else str(int(inp/idx))+" hours," if (i+1==2) else str(int(inp/idx))+" minutes," if(i+1==3) else str(inp)+" seconds."

print(calc)

inp-=idx*int(inp/idx)

write a program that asks the user to enter a number of seconds and then prints the-example-1
User KirkoR
by
4.7k points