Thursday, July 25, 2019

Digital time converter

Script

#!/usr/local/bin/python3.7

print()
seconds = int(input("Please enter the number of seconds: "))

hours = seconds // 3600

seconds = seconds % 3600

minutes = seconds // 60

seconds = seconds % 60

print()
print (hours, ":", sep = "", end = "")

tenthplace = minutes // 10
onethplace = minutes % 10

print(tenthplace, onethplace, ":", sep = "", end = "")

tenthplace = seconds // 10
onethplace = seconds % 10

print(tenthplace, onethplace, sep = "")
print()


Execution



Please enter the number of seconds: 3600

1:00:00


Please enter the number of seconds: 7531

2:05:31



Please enter the number of seconds: 11111

3:05:11



Please enter the number of seconds: 4573

1:16:13

No comments:

Post a Comment