Python Program to convert Kilometers to Miles

Kilometer is a unit of length in the metric system equivalent to 1000 meters.

Miles is also the unit of length equal to 1760 yards.

Example:



Input: 5.5 
Output: 3.418 

Input: 6.5
Output: 4.039

Formula:

1 kilometer equals 0.62137 miles.
Miles = kilometer * 0.62137   
Kilometer = Miles / 0.62137
filter_none

edit
close

play_arrow

link
brightness_4
code

# Python3 program to convert
# kilometers to miles
  
# driver code
kilometers = 5.5
  
# conversion factor
conv = 0.621371
  
# calculate miles
miles = kilometers * conv
print('%0.3f kilometers is equal to %0.3f miles' %(kilometers,miles))
  
kilometers = 6.5
  
# calculate miles
miles = kilometers * conv
print('%0.3f kilometers is equal to %0.3f miles' %(kilometers,miles))

chevron_right


Output:

5.500 kilometers is equal to 3.418 miles
6.500 kilometers is equal to 4.039 miles


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.