Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # read hours, minutes, seconds
- # convert hours + minutes + seconds to totalSeconds
- # convert totalSeconds back to hours + minutes + seconds
- import datetime
- hours = int(input("Please enter amount of hours: \n"))
- minutes = int(input("Please enter amount of minutes: \n"))
- seconds = int(input("Please enter amount of seconds \n"))
- totalSeconds = ((hours * 3600) + (minutes * 60) + seconds)
- print("The total amount of seconds is:", totalSeconds, "\n")
- originalTime = print(totalSeconds, "seconds in hh:mm:ss format is", str(datetime.timedelta(seconds = totalSeconds)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement