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)
Enter the value in kilometers: 10 The entered value in Miles: 6.21371
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
Leave a Reply