Excercise 2
Problem Statement: Take the Height of the user as input and convert it:
- To the Inches, if height entered in centimeters.
- To the centimeters, If the height is entered in inches.
Solution:
height = input(“Enter your Height: “)
unit = input(“(I)n or (C)m”)
if unit.upper() == ‘I’:
convert_value = height * 2.54
print(“Height in centimeters is ” + convert_value)
else:
convert_value = height / 2.54
print(“Height in inches is is ” + convert_value)