Python ProgrammingPython Programming

Convert human height in centimeters

Write a program in python that reads a number of feet from the user, followed by a number of inches. After that program should compute and display the equivalent number of centimeters.
Hint: One foot is 12 inches. One inch is 2.54 centimeters
#Python's program to convert height in feet and inches to centimeters.  

#Define the constants
CEN_IN_INCH	= 2.54

#Read the input(height) from human
print("Enter your height:")
feet = int(input(" Number of feet: "))
inches = int(input(" Number of inches: "))

#Convert the input in equivaltent centimeters
centimeters = (feet * CEN_IN_FEET + inches) * CEN_IN_INCH

#Display the result
print("Your height in centimeters is:",centimeters)
Sample output of above program.
Enter your height:
Number of feet: 5
Number of inches: 4
Your height in centimeters is: 162.56