Last active
May 22, 2024 12:14
-
-
Save chck/a1718d661eefdfbd052f56588dd26311 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Calcurate km/h from distance (km) and duration (mm:ss) to manage your workout. | |
# | |
# Usage: | |
# python phour.py 2.62 20:28 | |
# >> 7.68 km/h | |
# | |
from sys import argv | |
distance = argv[1] # 2.62 km | |
duration = argv[2] # 20.28 m | |
m, s = duration.split(':') | |
h = (int(m) + int(s)/60)/60 | |
phour = round(float(distance) / h, 2) | |
print(f"{phour} km/h") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment