Advertisement
mayankjoin3

number of days, hours, minutes, and remaining seconds. python

Mar 13th, 2024
775
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. def convert_seconds(seconds):
  2.     days = seconds // (24 * 3600)
  3.     seconds %= (24 * 3600)
  4.     hours = seconds // 3600
  5.     seconds %= 3600
  6.     minutes = seconds // 60
  7.     seconds %= 60
  8.     return days, hours, minutes, seconds
  9.  
  10. total_seconds = 500 * 10 * 60 # 500 code * 10 min per code * 60 seconds --> int(input("Enter the total number of seconds: "))
  11.  
  12. days, hours, minutes, seconds = convert_seconds(total_seconds)
  13.  
  14. print("Days:", days)
  15. print("Hours:", hours)
  16. print("Minutes:", minutes)
  17. print("Seconds:", seconds)
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement