Python Lesson 9 Exercises: Iteration, Tables, and more
In the following exercise, pay attention to your user interface, and be certain to test the programs rigorously. Save each program as pa9-1.py, pa9-2.py and so forth.
Exercise 1:
Create a program that displays a chart showing the powers of 2 (21, 22, 23, etc.) from 0 up to the number requested by the user.
Exercise 2:
Your basal metabolic rate (BMR) is the amount of energy your body needs to function at rest. Create a program that will print out a chart showing the BMR for a range of ages and weights when given the height and gender. Use the following calculations:
For men: BMR = 66 + (6.3 * body_weight_in_pounds) + (12.9 * height_in_inches) - (6.8 * age_in_years)
For Women: BMR = 655 + (4.3 * body_weight_in_pounds) + (4.7 * height_in_inches) - (4.7 * age_in_years)
Restricted access |