Python Convert Millimeters to Inches using Function

By | June 8, 2021

Python Convert Millimeters to Inches using function – This Python program will input millimeters  from the user. It will convert mm into inches.

Python convert millimeters to inches program using function

The Formula To Convert mm into Inches

To convert millimeters into inches, Multiply millimeters by 0.0393701 or divide millimeters by 25.4.

Source Code – Python Function To Convert mm to Inches

#Python program to convert millimeters (mm) to inches

def mm2inches(mm):
    inches = mm * 0.0393701
    inches = round(inches,4)
    return inches

# main
mm = float(input("Enter Milli Meters to convert into Inches:"))
inches = mm2inches(mm)
print(mm, "Milli Meters are = ", inches," Inches")
Output
------

Enter Milli Meters to convert into Inches:800
800.0 Milli Meters are =  31.4961  Inches

You will also like to read:

Loading

Leave a Reply

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