## “Chained” Conditional Statement

if test1:

action1_block

elif test2:

action2_block

elif test3:

action3_block

else:

else_action_block

def ticket_cost(age):

if age < 3:

cost = 0.0

elif age < 18:

cost = 5.50

elif age < 65:
cost = 9.25

else:

cost = 8.00

return cost

## Factorial Function

## factorial(x) produces the product ## of all the integers from 1 to n ## factorial: Nat -> Nat

## example:

## factorial(5) => 120 ## factorial(0) => 1
def factorial (x):

if x == 0:

return 1

else:

return x * factorial( x - 1)

### Limitations

factorial(1000) -> RuntimeError: maximum recursion depth exceeded

- There is a limit to how much recursion Python “can remember”

## Important

**If a function does not include a return
statement, then the produced value (and type) is None**

- The purpose statement does not need to include “Produces None” as this will be included in the contract.