Python Program to convert Kilometers to Miles

PythonServer Side ProgrammingProgramming

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−


 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")


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.


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

Published on 23-Dec-2019 12:06:29