Python Program to Convert Kilometers to Miles

Convert kilometres to miles in python. Python programming language can be used to convert kilometres to miles. In python programming, the software can convert kilometres to miles. In a python program, this will convert the distance from kilometres to miles.

km=float(input("Enter the KMs "))
conv_fac = 0.621371
mile=km*conv_fac
print(mile)

 

Output

Enter the KMs 56 34.796776

float() Function in Python

The float() function in Python converts a number in a string or integer to a floating point number, or a decimal value. In Python, there are two sorts of numbers: floating-point numbers (floats) and integers. Integers cannot contain decimals, although floats may. In Python, the float type represents a floating point number. A decimal point divides the integer and fractional elements of a float, which is used to represent real values.

Mile Calculation

The mile is a British imperial unit of measurement and a US customary unit of distance based on the old English unit of length of 5,280 English feet (1,760 yards). The kilometre, like the mille, is a unit of measurement. A mile, on the other hand, is longer than a kilometre. A “mile” is a larger measurement unit. All of these units are used to measure distance.