Python Program to Convert Kilometers to Miles : User is asked to enter kilometers. This value is stored in the kilometers variable.In this program, we will learn about the python program to convert kilometers to miles.
Python Program to Convert Kilometers to Miles
# Taking kilometers input from the user kilometers = float(input("Enter value in kilometers: ")) # conversion factor conv_fac = 0.621371 # calculate miles miles = kilometers * conv_fac print('%0.2f kilometers is equal to %0.2f miles' %(kilometers,miles))
Output of Program