# Python Program to Convert Kilometres into Miles – The Simplest way

In this Python example, we will discuss how to convert the given distance in kilometers into miles. Let’s get started.

## 1. What are Kilometer and mile?

The distance between two points can be measured in different ways. There are different scales like centimeter, meter, kilometer, foot, miles, feet, inch.

In this python program, we will convert kilometers into miles using specific values.

A Kilometer is 0.621371 miles.

Some of the topics which will be helpful for understanding the program implementation better are:

## 2. Conversion of kilometer into miles using Python

The user will provide the input value for the kilometer and the output miles

```#Python program to convret kilometers into miles
kilo_mtr = int(input("Enter distance value in kilometer: "))

mile = 0.621371 * kilo_mtr
print("Distance in Miles is: ", mile)```
```Output
Enter distance value in kilometer: 56
Distance in Miles is:  34.796776```

In the above program, the user will provide the value for distance in kilometers and the output will be provided for the value of the miles for the given kilometers.

We can implement the same program defining a simple function.

Let’s see how it works.

```#Python program to convret kilometers into miles  using function
def convert_to_miles(kilo_mtr):
return (0.621371 * kilo_mtr)

kilo_mtr = int(input("Enter distance value in kilometer: "))

print("Distance in Miles is: ", convert_to_miles(kilo_mtr))```
```Output
Enter distance value in kilometer: 783
Distance in Miles is:  486.533493```

## 3. Conclusion

In this article, we discussed how can we convert given kilometers into miles using python code. We have used simple input-output operations, function and arithmetic operations

Please follow the Python tutorial series or the menu in the sidebar for the complete tutorial series.

Also for examples in Python and practice please refer to Python Examples.

Complete code samples are present on Github project.

Recommended Books

An investment in knowledge always pays the best interest. I hope you like the tutorial. Do come back for more because learning paves way for a better understanding

Do not forget to share and Subscribe.

Happy coding!! ?

Subscribe
Notify of