5. Nested Structures¶
Consider the telephone company “Chao”. Below 200 minutes, the company charges
$0.20
per minute. Between 200 and 400 minutes, the price is$0.18
. Above 400 minutes, the price per minute is$0.15
. Calculate your phone bill with these conditions.The company’s conditions can be visually represented by the path of a road like the following image.

Nested conditions can be created.
Remember to indent nested portions of code.
Activity: CodeLens 5.1 (cl_l10_5a_en)
Note the double indentation to satisfy the second condition.
Now we modify the “Chao” company program for a promotion where the rate is
$0.08
when you use more than 800 minutes.
Activity: CodeLens 5.2 (cl_l10_5b_en)
Note that nested structures can grow.
Python, given its characteristics, provides the “elif” clause.
It is used to check multiple conditions.