Chapters: 1 & 2

LAB 1-1

Use interactive Python to:

1. Calculate the BMI (Body Mass Index) of a 5'7-3/4" person who weighs 148 pounds. Info on BMI calculation is below:
To figure your body mass index, divide your weight in pounds by your height in inches squared; then multiply the result by a conversion factor of 703. The formula is: BMI = weight in pounds / [height in inches x height in inches] x 703.

2. Set a variable named num to 26. Then write an expression that outputs the value of num-cubed (raised to the third power).

3. Set a variable named myName to your full name. Then write an expression using myName that outputs a string similar to this one: My full name is Mary Ann May-Pumphrey only with your name instead of mine.

4. Set a variable named word to one of your favorite words. Then write an expression using word that outputs it 7 times, all in one left-to-right line. For example, my expression outputs:
'PenultimatePenultimatePenultimatePenultimatePenultimatePenultimatePenultimate'

5. Set a variable named miles to any floating point number you choose. Then write an expression using miles that outputs the number of feet in that quantity of miles.

To submit your work, simply copy/paste all five chunks of code into this assignment. Please put blank lines between each chunk and number each chunk. Use a Python comment for each blank line if you like!


LAB 1-2

Use Python/IDLE to create a script file that will print out a non-metric (ounces!) version of this Chinese Almond Cookie recipe. (FWIW, I do NOT recommend you try this recipe!)
Below is my output, which you should try to match as closely as possible. Of course, your Python code must CALCULATE the proper non-metric amounts! You may NOT just "hard-code" the values that my output shows.
Use the formula on this page to convert from grams to ounces.
Think about using variables to store values that you may need to use more than once. Also, think about using variables to store values just to make the code easier to read!

4.056506071355 oz butter, softened in room temperature
1 egg yolk
1/4 tsp. almond extract
4.232875900544348 oz cake flour
2.116437950272174 oz almond flour
1 small pinch of salt
1.234588804325435 to 1.4109586335147828 oz sugar
1/2 tsp. baking soda
16 whole almonds for decoration