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


Introduction

Write a Python program to convert height (in feet and inches) to centimeters. I have used python 3.7 compiler for debugging purpose.


techstudy.org

HP 15 Core i3 7th gen Laptop(4GB, 1TB HDD, Windows 10) | Rs. 31,490

  1. print("Input your height: ")
  2. h_ft = int(input("Feet: "))
  3. h_inch = int(input("Inches: "))
  4.  
  5. h_inch += h_ft * 12
  6. h_cm = round(h_inch * 2.54, 1)
  7.  
  8. print("Your height is : %d cm." % h_cm)
  9.  

Result

python language techstudy.org

     





Related Topics




Popular Posts