Skip to content

Commit 392a9e6

Browse files
Geographic Distance: add km_to_miles() and show distance in km and miles
1 parent 0a32153 commit 392a9e6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Geographic Distance/geographic_distance.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ def validate_coordinates(coord):
2626
raise ValueError(f"Longitude {lon} out of range (-180..180)")
2727
return coord
2828

29+
def km_to_miles(km: float) -> float:
30+
"""Convert kilometers to miles."""
31+
return km * 0.621371
32+
2933

3034

3135

0 commit comments

Comments
 (0)