Convert Kilometers to Miles

This is a simple python script to convert Kilometers to miles. The program asks the user to enter the kilometre to be converted to miles. Then the program multiplies the entered kilometres with the conversion factor value 0.621371 and gets the corresponding miles.

Program Sources

# Program to convert kilometers into miles

# Getting the value from user
kilometers = float(input('Enter The Kilometer value To be Converted: '))

# conversion factor
conv_factor = 0.621371

# calculate miles
miles = kilometers * conv_factor
print('%0.3f kilometers = %0.3f miles' %(kilometers,miles))

Program Output

Enter The Kilometer value To be Converted: 25
25.000 kilometers = 15.534 miles

Enter The Kilometer value To be Converted: 124
124.000 kilometers = 77.050 miles


Post a comment

Name

Your Comment

Email (We dont publish it)

Comments

rob | June 4, 2017 3:14 PM |

ok