Reading Time: 1 minutes
Unit Conversion: Height in centimetres in Python - Python code to convert height from feet and inches to centimeters.
Unit Conversion: Height in centimetres in Python
# Have your user input his height in feet and inches. Then, convert the feet and inches into centimetres according to the following facts. # 1 foot = 12 inches # 1 inch = 2.54 centimetres print("How tall are you in feet and inches?") feet = int(input("Feet: ")) inches = float(input("Inches: ")) cms = (feet * 12 + inches) * 2.54 print("Your height in centimetres:", cms)
Try it here.