- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Python Program to Read Height in Centimeters and convert the Height to Feet and Inches
When it is required to read the height in ‘cm’ and convert it into ‘feet’ and ‘inches’, the ‘round’ method can be used.
Below is a demonstration of the same −
Example
in_cm=int(input("Enter the height in centimeters...")) in_inches=0.394*in_cm in_feet=0.0328*in_cm print("The length in inches is ") print(round(in_inches,2)) print("The length in feet is") print(round(in_feet,2))
Output
Enter the height in centimeters...178 The length in inches is 70.13 The length in feet is 5.84
Explanation
The input is taken by user, as ‘cm’.
It can be converted into inches by multiplying it with 0.394.
This is assigned to a variable.
It can be converted into feet by multiplying it with 0.0328.
This is assigned to a variable.
It is rounded off to nearest two decimal values.
Both these converted values are displayed as output on the console.
- Related Articles
- Golang Program to Convert Centimeters into Feet and Inches
- Program to Convert Centimeter to Feet and Inches in C
- MySQL query to convert height format to centimeters?
- C++ Program to read the height of a person and the print person is taller, dwarf, or average height person
- Program to find maximum building height in Python
- Convert distance from km to meters and centimeters in PL/SQL
- Program to find a matrix for each condominium's height is increased to the maximum possible height in Python?
- What is the difference between height and line-height?
- C++ program to find out the center coordinates and the height of a building
- Getting screens height and width using Tkinter Python
- How to get the height and width of the android.widget.ImageView?
- Java Program to increase the row height in a JTable
- How to set viewport height and width in CSS
- How to set cell width and height in HTML?
- How to use height and width attributes in HTML?

Advertisements