BeginnersBook

  • Home
  • Java
    • Java OOPs
    • Java Collections
    • Java Examples
  • C
    • C Examples
  • C++
    • C++ Examples
  • DBMS
  • Computer Network
  • Python
    • Python Examples
  • More…
    • jQuery
    • Kotlin
    • WordPress
    • SEO
    • JSON
    • JSP
    • JSTL
    • Servlet
    • MongoDB
    • XML
    • Perl

Python Program to Convert Kilometers(km) to Miles(mi.)

Last Updated: June 8, 2018 by Chaitanya Singh | Filed Under: Python Examples

In this tutorial we will see how to convert Kilometers to Miles in Python.

Kilometers to Miles Conversion in Python

This program prompts the user to enter the value in Kilometers and converts it into Miles by multiplying the entered value with 0.621371 (1 Km = 0.621371 mi.).

# Program published on https://beginnersbook.com

# Program to convert Kilometers to Miles
km = int(input("Enter the value in kilometers: "))

# 1 Kilometre = 0.621371 Mile
ratio = 0.621371

# Converting km to mi.
mi = km * ratio

print("The entered value in Miles: ", mi)

Output:

Enter the value in kilometers: 10
The entered value in Miles:  6.21371

Python program to convert Kilometers to Miles

Related Python Examples:

1. Python program to swap two numbers
2. Python program to print Calendar
3. Python program to add two binary numbers
4. Python program to convert Decimal to Binary

Top Related Articles:

  1. Python Program to Swap Two Numbers
  2. Python Program to Check if a Number is Positive Negative or Zero
  3. Python Program to Print Calendar
  4. Python Program to Convert Decimal to Hexadecimal
  5. Python Program to Convert Celsius To Fahrenheit and Vice Versa

About the Author

I have 15 years of experience in the IT industry, working with renowned multinational corporations. Additionally, I have dedicated over a decade to teaching, allowing me to refine my skills in delivering information in a simple and easily understandable manner.

– Chaitanya

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Copyright © 2012 – 2025 BeginnersBook . Privacy Policy . Sitemap