The Body Mass Index (BMI) is a screening measure meant to
approximate a person's body fat based upon his or her height and
weight. Let W represnet a weight (measured in pounds) and H
represent a height (measured in inches). Then the index is
calculated according to the formula
This statistic can be used to classify a person into one of four categories:
Wirte a program that asks the user for the height and weight and reports the BMI and the appropriate classification. A sample session might appear as follows:
What is your height (in inches): 70
What is your weight (in pounds): 140
Your BMI is 20.0857
This is in the normal range.
Print the numbers from 10 down to 1.
Print all odd numbers from 1 to 20.
Input an integer N, and calculate the sum
Given a positive integer k, calculate the factorial of
k defined as
The precise value of the mathematical constant pi is equal to
the following infinite serioes:
Write a program that asks the user for the number of desired terms and then prints an approximation to pi by computing the first so many terms of this series.
Write a program that prints an n-level staircase made of text, such as the example for n=4 shown here.
*
* *
* * *
* * * *
Write a program that prints out an
1 2 3 4
2 4 6 8
3 6 9 12
4 8 12 16
Note: to align columns, you can force a value to be printed right-justified with a given using a syntax str(val).rjust(3) when printing the value of variable val.
Redo the previous problem, yet with a nicer output format:
| 1 2 3 4
---+----------------
1 | 1 2 3 4
2 | 2 4 6 8
3 | 3 6 9 12
4 | 4 8 12 16