Program to Convert Kilometer into Miles in Python

Python program to convert kilometer into miles. This is a basic conversion program in python language. This program is useful for beginners, class 11, 12 and B Tech computer science students. We follow stepwise format so that beginners and student understand its well. Download source code.

Aim- Converting Kilometer into Miles

Mathematical calculation:

1 kilometre equals 0.62137 miles.  
Miles = kilometre * 0.62137  
And,  
Kilometre = Miles / 0.62137

Source code :

kilometre_1 = float (input ("Please enter the speed of car in Kilometre as a unit: "))  
conversion_ratio_1 = 0.621371  
miles_1 = kilometre_1 * conversion_ratio_1  
print ("The speed value of car in Miles: ", miles_1

Click below button to Download Source Code

Step 1: We will define the variable for storing the value of kilometre_1 and accepting the input from the user.
kilometre_1 = float (input (“Please enter the speed of car in Kilometre as a unit: “))  
Step 2: Now, we will define and store the conversion factor into the variable.0
conversion_ratio_1 = 0.621371  
Step 3: Then, we will define the variable for storing the value of kilometre_1 which is converted into miles. Then in addition we will write the logic of converting kilometre to miles units.
miles_1 = kilometre_1 * conversion_ratio_1  
Step 4: At last, we will display the converted value by using the print() function.
print (“The speed value of car in Miles: “, miles_1)  

Output :

Output Explanation :

Please enter the speed of car in kilometer as a unit is printed by the print function. Here we are giving a value of 52 as input.
The speed value of car in miles is 32.311292 which is calculated by the program through mathematical calculation.

Thank you for reading and learning from Python Program to Convert Kilometer into Miles. This is a necessary and basic conversion. This program is useful for the beginners, class 11, 12 and B Tech computer science students. More programs are below for practice.

Python Programs Archives – CS Study

Computer Science with Python Practical Book Solutions Class 11 Term -2 – CS Study

Computer Science Practical file for class 12 Term-2 – CS Study

Leave a Comment

Your email address will not be published. Required fields are marked *