Convert Kilometers to Miles in Python

(Last Updated On: 04/11/2022)

Python Program To Convert Kilometers To Miles

# Convert Kilometers to Miles in Python

# Taking kilometers input from the user
kilometers = float(input("Enter value in kilometers: "))

# conversion factor
con_factor = 0.621371

# calculate miles
miles = kilometers * con_factor

# Print Result
print('%0.2f kilometers is equal to %0.2f miles' %(kilometers,miles))

Output:

Enter value in kilometers: 200
200.00 kilometers is equal to 124.27 miles

Leave a Reply

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