Here is a simple Python program that can convert kilometers to miles:

					# Define the conversion factor
KM_TO_MILES = 0.621371

# Get the distance in kilometers from the user
km = float(input('Enter the distance in kilometers: '))

# Convert the distance to miles
miles = km * KM_TO_MILES

# Print the result
print(f'{km} kilometers is equal to {miles} miles.')


This program uses a conversion factor of 0.621371 to convert kilometers to miles. This factor is defined at the beginning of the program, so you can easily change it if you need to use a different conversion factor.

The program gets the distance in kilometers from the user and stores it in a variable called km. This distance is converted to miles by multiplying it by the conversion factor. The result is stored in a variable called miles.

Finally, the program prints the result to the user. This is done using a formatted string, which allows you to insert the values of the km and miles variables directly into the output string.

To run this program, you will need to have Python installed on your computer. You can then run the program by using the python command followed by the name of the file that contains the program, like this:



Make sure to replace with the actual name of the file that contains the program. This will run the program and prompt the user to enter the distance in kilometers. Once the user has entered a value, the program will convert it to miles and print the result.

Thanks for reading. Happy coding!