This Python program converts kilometers to miles. It takes input from the user in the form of kilometers and performs simple arithmetic operations for the expected output.
#Taking user input km = float(input("Enter value in kilometers: ")) #Conversion factor cf = 0.621371 #Calculate miles miles = km * cf #Print the output print('%0.2f kilometers is equal to %0.2f miles' %(kilometers,miles))
Enter value in kilometers: 12 12.00 kilometers is equal to 7.46 miles
Found This Useful? Share This Page!