Q:

Write a Python program to convert height (in feet and inches) to centimeters

belongs to collection: python basic programs with examples

0

Write a Python program to convert height (in feet and inches) to centimeters

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

I have used python 3.7 compiler for debugging purpose.

print("Input your height: ")
h_ft = int(input("Feet: "))
h_inch = int(input("Inches: "))
 
h_inch += h_ft * 12
h_cm = round(h_inch * 2.54, 1)
 
print("Your height is : %d cm." % h_cm)

Result:

Input your height: 

Feet: 5

Inches: 4

Your height is : 162 cm.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

python basic programs with examples

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Write a Python program to convert the distance (in... >>
<< Write a python program to sum of the first n posit...