PythiloLesson 6 of 30 · progress kept in this browser

Branching

if, elif and else run the first block whose condition is true. Indentation marks the block.

def label(n):
    if n < 0:
        return "negative"
    elif n == 0:
        return "zero"
    else:
        return "positive"
Your task

Write shipping_cost(weight_kg, express=False): 0 for weight 0 or less, 5 up to and including 1 kg, 9 up to and including 5 kg, 15 above that, and express doubles the price. Write is_leap(year) for the Gregorian rule: divisible by 4, except centuries, unless divisible by 400.