Python Program to Convert Distance from Kilometer to Mile

Here we are writing a Python Program to Convert the distance from Kilometer to Miles.

We ask the user to enter the distance in Kilometers and then we calculate the distance in Miles and display that back to user on screen.

The formula that we are using is Distance in Miles = Distance in Kilometers * 0.621371

distance.py

1 km = float(input("Enter the distance in Kilometers: "))
2 
3 mile = km * 0.621371
4 
5 print('%.2f Kilometer = %0.2f Miles' %(km, mile))

Python Program to Convert Distance from Kilometer to Mile video tutorial