Write a Python program to convert Kilometres to Miles
1st way to write program
T4Tutorials_KM = float (input ("Please enter the speed of the motor cycle in Kilometre as a unit: "))
ConversionRatio = 0.621371
Miles = T4Tutorials_KM * ConversionRatio
print ("The speed value of the motor cycle in Miles: ", Miles)
Output
Please enter the speed of the motorcycle in Kilometre as a unit: 6
The speed value of the motorcycle in Miles: 3.7282260000000003
2nd way to write program
def T4Tutorials_KM(km):
ConversionRatio= 0.621371
miles_1 = km * ConversionRatio
print ("The speed value of car in Miles: ", miles_1)
km = float (input ("Please enter the speed of car in Kilometre as a unit: "))
T4Tutorials_KM(km)
Output
Please enter the speed of car in Kilometre as a unit: 088
The speed value of car in Miles: 54.680648