# Python program to convert Centimeter to Inches

Centimeter to Inches conversion: Here, we are going to learn how to convert centimeter to inches using python program?
Submitted by Anuj Singh, on July 11, 2019

There are many problems where we have to calculate the distance in inches at the end but initially, the measurements are given in centimeters. So for such type of problems, the solution is converting the initial parameters into inches and then performing operations on it and another option is to perform operations in centimeters and then convert the final answer from centimeters to inches.

So, here in this article, we are going to write a Python code for converting the centimeters into inches.

Key: 1 inch = 2.54 cms

Example:

```    Input:
Centimeter: 245

Output:
Inches: 96.45669291338582
```

Python code to convert 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
```

TOP Interview Coding Problems/Challenges

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates