Python Program to convert Kilometers to Miles


In this article, we will learn about the solution to the problem statement given below.

Problem statement − We are given distance in kilometers and we need to convert it into miles

As we know that 1 kilometer equals 0.62137 miles.

Formula Used

Miles = kilometer * 0.62137

Now let’s observe the concept in the implementation below−

Example

 Live Demo

kilometers = 5.5
# conversion factor as 1 km = 0.621371 miles
conv = 0.621371
# calculation
miles = kilometers * conv
print(kilometers,"kilometers is equal to ",miles,"miles")

Output

5.5 kilometers is equal to 3.4175405 miles

All the variables are declared in the local scope and their references are seen in the figure above.

Conclusion

In this article, we have learned about the conversion of distance given in kilometers into miles.

Updated on: 23-Dec-2019

200 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements