Python program to Convert Centimeter to Inches

Centimetre to Inches transformation: Here, we will figure out how to change over centimetre to inches utilizing python program?

There are numerous issues where we need to compute the separation in creeps toward the end yet at first, the estimations are given in centimetres. So for such sort of issues, the arrangement is changing over the underlying parameters into inches and afterwards performing activities on it and another alternative is to perform tasks in centimetres and afterwards convert the last answer from centimetres to inches.

Thus, here in this article, we will compose a Python code for changing over the centimetres into inches.

Key: 1 inch = 2.54 cms

Example:

    Input:
    Centimeter: 245

    Output:
    Inches: 96.45669291338582 

Python code to change over Centimeter to Inches:

# Python program to convert Centimeter to Inches 
# taking input
num = float(input("Enter the distance measured in centimeter : "))

# converting from cms to inches
""" 1 inch = 2.54 centimeters"""
inc = num/2.54 

# printing the result
print("Distance in inch : ", inc)

Output:

First run:
Enter the distance measured in centimeter : 245
Distance in inch :  96.45669291338582

Second run:
Enter the distance measured in centimeter : 54
Distance in inch :  21.25984251968504 

Third run:
Enter the distance measured in centimeter : 2.54
Distance in inch :  1.0

Leave a Comment

error: Alert: Content is protected!!