How to Write a Python Program to Convert Distance from Kilo meter to Mile

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

We ask the user to enter the distance in Kilom eters 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 Kilo meters * 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