"""Solution 10.11.2 — A safe default

Chapter 10: Functions — Everyday Programming

Bug type: Logical

The guard checks for None, but the default is a shared list, not None,
so the guard never runs and the list grows. Make the default None.

Exercise: ex_10_11_2.py
"""

def add_reading(value, readings=None):
    if readings is None:
        readings = []
    readings.append(value)
    return readings

print(add_reading(20))  # [20]
print(add_reading(22))  # [22]
