Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created August 16, 2021 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/b477a2f9e63ea73ccc1681a05a9ced78 to your computer and use it in GitHub Desktop.
Save parzibyte/b477a2f9e63ea73ccc1681a05a9ced78 to your computer and use it in GitHub Desktop.
"""
https://parzibyte.me/blog
"""
def segundos_a_segundos_minutos_y_horas(segundos):
horas = int(segundos / 60 / 60)
segundos -= horas*60*60
minutos = int(segundos/60)
segundos -= minutos*60
return f"{horas:02d}:{minutos:02d}:{segundos:02d}"
segundos = [10, 100, 40, 1500, 6000, 60, 59, 100000]
for cantidad_segundos in segundos:
convertido = segundos_a_segundos_minutos_y_horas(cantidad_segundos)
print(f"Los {cantidad_segundos} segundos se convierten a {convertido}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment