How to Convert Centimeter into Feet Inches in Python


In this example we will show how to convert the centimeter unit into foot/inch unit in Python.

Source Code

#! /usr/bin/env python3
# -*- coding: utf-8 -*-

cm = int(input("Enter the length in centimeters: "))
inches = 0.3937 * cm
feet = 0.03281 * cm
print("The length in inches is {:.2f}".format(inches))
print("The length in feet is {:.2f}".format(feet))

Output:

Enter the length in centimeters: 20
The length in inches is 7.87
The length in feet is 0.66

Enter the length in centimeters: 68
The length in inches is 26.77
The length in feet is 2.23
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments