You are on page 1of 1

ICS Function Assignment

These exercises focus on function basics.


/40
- def keyword
- call back
- argument(s)
- return statement
- IPO model

Create Python programs to do the following:

1. Choose ten built-in python functions of your choice and demonstrate their use by providing example
code for each (e.g., print, len(), randint() …). [10 Marks]

2. Using your knowledge of functions, create a program that calculates the area of a circle and outputs
the area when finished. Refer to your notes and online documentation for reference. [10 Marks]

3. 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. [20 Marks]

Save as functionsAssignment1.py

You might also like