Instructions

The function in the code box is intended to calculate the total area of the four sides of a box (not the top and bottom). Fix all the errors.

Warning: Do not change the name of the function.

Note:

Removing the capitals from the names of the identifiers was necessary for convention, but not for correctness.

Indenting evenly was required for correctness; indenting four spaces was for convention only.

Hints:

  • Check indentation.

The code box contains the solution to the target heart rate problem for specific values. Modify the solution to create a function target that consumes three numbers (age, resting heart rate, and intensity) and produces the target heart rate.

Here is a reminder of how it is calculated:

The target heart rate is the sum of the resting heart rate and the product of the target intensity and the heart rate reserve.

The heart rate reserve is the difference between the maximum heart rate and the resting heart rate.

The maximum heart rate is calculated as 220 minus the age.

Warning: Make sure to use the name of the function given in the instructions.

You might wish to use the function definition recipe on the Help page.

Note:

Hints:

  • Make sure to include the parameters in the order given in the instructions.

Write a function volume_cylinder that consumes the diameter in metres and produces the volume of a cylinder of length 2 metres. A function area_circle has been loaded for your convenience.

Warning: Make sure to use the name of the function given in the instructions.

Note:

Hints:

  • Make sure to import math.

Modify your function volume_cylinder so that it now has two parameters, the diameter and the length in metres.

Warning: Make sure to use the name of the function given in the instructions.

Note:

Hints:

  • Make sure that the parameters are in the correct order: diameter first and length second.

Write a function upper_lower that consumes a string plain and produces a string with the same characters as in plain except that all letters in the first half of the string are in upper case and all the rest of the letters are in lower case. Non-letters should be the same.

If the length of the string is odd, the "first half" should contain the middle character.

Warning: Make sure to use the name of the function given in the instructions.

Note:

Hint:

  • Do not use input to provide the input.

Write a function meal_bill that consumes the food cost, tip percentage, and tax percentage, and produces the total bill. The tip should be applied to the food cost only and the tax should be applied to the food cost only.

For example, the total cost of a $100 meal with 15% tip and 13% tax would be calculated using the function call meal_bill(100, 15, 13).

Warning: Make sure to use the name of the function given in the instructions.

Note:

Hints:

  • To multiply a value by 15 percent, remember to divide by 100 as well as multiplying by 15.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX