12. Write a python program to allow user to input their weight and height in order to calculate the BMI of user. [formula of BMI = weight (kg) / height (m)]
The output is:
Please input your weight in kg: 50
Please input your height in m: 1.56
Expected Answer:
Please input your weight in kg: 50
Please input your height in m: 1.56
Your BMI is 20.55
Answer:
weight = float(input("Please input your weight in kg: ")) height = float(input("Please input your height in m: ")) bmi = weight/(height**2) print("Your BMI is", round(bmi, 2))
More Exercises:
Python String ExercisesMore Numpy Exercises:
Numpy String ExercisesMore Pandas Exercises:
Pandas Series ExercisesMore Tutorials:
Python Installation - Linux (Ubuntu)