Advertisement
BobMe

python thing 2

Feb 12th, 2020
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. def findtime(seconds):
  2. if seconds == None: seconds = 0
  3. minutes = 0
  4. hours = 0
  5. days = 0
  6. years = 0
  7. while seconds >= 60:
  8. seconds = seconds - 60
  9. minutes = minutes + 1
  10. while minutes >= 60:
  11. minutes = minutes - 60
  12. hours = hours + 1
  13. while hours >= 24:
  14. hours = hours - 24
  15. days = days + 1
  16. while days >= 365:
  17. days = days - 365
  18. years = years + 1
  19. #LINE OF STRINGS -----
  20. if seconds < 10: seconds = "0"+str(seconds)
  21. seconds = str(seconds)
  22. if minutes < 10: minutes = "0"+str(minutes)
  23. minutes = str(minutes)
  24. if hours < 10: hours = "0"+str(hours)
  25. hours = str(hours)
  26. if days < 10: days = "0"+str(days)
  27. days = str(days)
  28. if years < 10: years = "0"+str(years)
  29. years = str(years)
  30. print("-------------------\n"+years+":"+days+":"+hours+":"+minutes+":"+seconds+"\nyy:dd:hh:mm:ss\n\n")
  31.  
  32. while True:
  33. kek = int(input("seconds: "))
  34. findtime(kek)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement