You are on page 1of 2

ICS3U - User Defined Function Assignment

These exercises focus on function basics.


- def keyword
- call back
- argument(s)
- return statement
- variable scope (local/global)
- IPO model

Create Python programs to do the following:

1. The calculation for body mass index (BMI), depends on the units given for weight and height.
Metric calculation: weight is given in kilograms and height in metres and the formula is as
follows:

Imperial calculation: weight is given in pounds and height in inches and the formula is

The meanings of the scores are as follows:

 Less than 18.5  underweight


 18.5 – 25  normal
 Over 25 but less than 30  overweight
 30 and over  obese

Instructions

Write a python program to include your own functions in its design. It should still ask the user for
their name, a system of measurement to use (imperial or metric), their height, their weight, and then
calculates their BMI. Output should be a message to the user reiterating their statistics and stating
their BMI and what it means. TIP: You must use functions where appropriate and define them
at the top of your program.

Sample output:
Donald, with a height of 72 inches and a weight of 170 pounds, you
have a BMI of 23. This is considered normal.

Save as bodyMassIndexFunc.py
Rubric
Level 1 Level 2 Level 3 Level 4
Categories
(50 - 59%) (60 - 69%) (70 - 79%) (80 - 100%)
A3.2 write subprograms -writes a subprogram - writes a - writes a - writes a subprogram
(e.g., functions, procedures) program with limited subprogram program subprogram program program with a high
that use parameter passing effectiveness with some with considerable degree of effectiveness
and appropriate variable effectiveness effectiveness
scope (e.g., local, global), to
perform
tasks within programs.

Note: A student whose achievement is below Level 1 (50%) has not met the expectations for this
assignment or activity.

You might also like