Python example to convert Miles to Kilometers

miles = float(input("Enter the value in miles: "))
conversion_factor = 1.60934
kilometers = miles * conversion_factor
print('%.4f miles = %0.4f kilometers' %(miles, kilometers))

OUTPUT:

Enter the value in miles: 4
4.0000 miles = 6.4374 kilometers

Leave a Comment