# Python Program to Convert Kilometers to Miles

There are different ways to convert kilometers to miles depending on your needs. One simple way is to multiply the number of kilometers by 0.62137112. For example, 10 kilometers is equal to 10 x 0.621371 = 6.21371 miles.

## Python Code : #

The below Python program to converts kilometers to miles:

``````
# Get input distance in kilometers from user
km = float(input("Enter distance in kilometers: "))

# Convert kilometers to miles using the conversion factor 0.621371
miles = km * 0.621371

# Print the result
print(km, "kilometers is equal to", miles, "miles")

``````

In this program, the user is prompted to enter a distance in kilometers. The distance is then converted to miles using the conversion factor 0.621371, which is the number of miles in a kilometer. The converted distance is stored in the variable miles.

Finally, the program prints out the original distance in kilometers and the converted distance in miles using the print function.

Note that this program assumes that the user enters a valid floating-point number for the distance in kilometers. If the user enters an invalid input, such as a string or a negative number, the program will raise a ValueError or produce an incorrect result.

For example : if km = 1000 then the exprected miles is :

``````
1000.0 kilometers is equal to 621.371 miles

``````