# Python Program to Convert Kilometers to Miles

In this example, we'll learn how to convert kilometers to miles using python program.

## Formula to convert kilometer to miles

``````11 kilometer equals 0.62137 miles.
2Miles = kilometer * 0.62137  ``````

## Formula to convert miles to kilometer

``1kilometer = Miles / 0.62137  ``

## Example program to convert Kilometer to Miles

``````1# Taking kilometers input from the user
2kilometers = float(input("Please enter value in kilometers: "))
3
4# conversion factor
5conversion_factor = 0.621371
6
7# calculate miles
8miles = kilometers * conversion_factor
9print(f'{kilometers} kilometers is equal to {miles} miles')``````

Output:

``````1Please enter value in kilometers: 10
210.0 kilometers is equal to 6.21371 miles``````

## Example program to convert Miles to Kilometer

``````1# Taking miles input from the user
2miles = float(input("Please enter value in miles: "))
3
4# conversion factor
5conversion_factor = 0.621371
6
7# calculate miles
8kilometers = miles / conversion_factor
9print(f'{miles} miles is equal to {kilometers} kilometers')``````

Output:

``````1Please enter value in kilometers: 6.21371
26.21371 miles is equal to 10.0 kilometers``````