Skip to content.

Sections
Personal tools
You are here: Home Assignments Assignment 0
Document Actions

Assignment 0

by Max Chang last modified 2007-01-09 01:22 PM

BMI Calculator

due Sunday January 14

Motivation

The goal of this assignment is to write a simple function that computes a person's body mass index (BMI). BMI can be used to indicate if a person is overweight, obese, underweight or normal.

Task

Your program will ask the user to enter height and weight. To keep this assignment simple, you will ask the user to enter height in inches and weight in pounds. You will then display the calculated BMI with a prompt saying, Your calculated BMI is X, where X indicates the calculated BMI value.

Additional information

The following is a table that shows you how BMI can be interpreted:

BMI Weight status
Below 18.5 Underweight
18.5 – 24.9 Normal
25.0 – 29.9 Overweight
30.0 and Above Obese

Body Mass Index does not consider lean body mass. It is possible for a healthy, muscular individual with low body fat to be classified as obese using the Body Mass Index formula.

Details

Your program should first convert the user-entered height to meters by dividing the height by 39.37. Similarly, the weight in kilograms is obtained by dividing the input weight by 2.2046. BMI is calculated with the following formula:

BMI = (weight in kg)/(height in meters)^2

Assignment submission details

  1. Place all of your code in a file called BMICalculator_<UCID>.py (where <UCID> corresponds to your UCSD e-mail address). For instance jsmith@ucsd.edu would turn in BMICalculator_jsmith.py
  2. Write a very brief ASCII text file called README_BMICalculator_<UCID>.txt documenting your progress (e.g. showing experiments you did to show the code working), and anything else you want to communicate about the assignment.
  3. Attach both of these files to an e-mail message addressed to cg8w1@icogsci1.ucsd.edu, with the subject "<UCID> BMICalculator.py"
  4. Send the email no later than Sunday, January 14 at 11:59 pm.

Hints/Recommendations

  • Accomplish earlier steps before attempting later ones!
  • Make sure the code you submit is well documented, since this will make it more likely the graders will understand what you were trying to do.
  • If you get stumped before you finish the entire assignment:
    1. document your accomplishments.
    2. describe the problem that stopped you, what you tried, what confused you, etc.
 

Powered by Plone, the Open Source Content Management System