Introduction to Programming using Python 1st Edition

Published by Pearson
ISBN 10: 0132747189
ISBN 13: 978-0-13274-718-9

Chapter 2 - Elementary Programming - Section 2.11 - Type Conversions and Rounding - Check Point - MyProgrammingLab - Page 46: 2.17

Answer

# (Health application: compute BMI) Body mass index (BMI) is a measure of health # based on weight. It can be calculated by taking your weight in kilograms and # dividing it by the square of your height in meters. Write a program that prompts # the user to enter a weight in pounds and height in inches and displays the BMI. # Note that one pound is 0.45359237 kilograms and one inch is 0.0254 meters. weight = eval(input("Enter weight in pounds:")) height = eval(input("Enter height in inches:")) weight = weight *0.45359237 height = height *0.0254 bmi = weight / height**2 print("BMI is",bmi)

Work Step by Step

# (Health application: compute BMI) Body mass index (BMI) is a measure of health # based on weight. It can be calculated by taking your weight in kilograms and # dividing it by the square of your height in meters. Write a program that prompts # the user to enter a weight in pounds and height in inches and displays the BMI. # Note that one pound is 0.45359237 kilograms and one inch is 0.0254 meters. weight = eval(input("Enter weight in pounds:")) height = eval(input("Enter height in inches:")) weight = weight *0.45359237 height = height *0.0254 bmi = weight / height**2 print("BMI is",bmi)
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.