字典鍵初始化
如果你不確定金鑰是否存在,請首選 dict.get 方法。如果找不到金鑰,它允許你返回預設值。傳統方法 dict[key] 會引發一個 KeyError 異常。
而不是做
def add_student():
    try:
        students['count'] += 1
    except KeyError:
        students['count'] = 1
做
def add_student():
        students['count'] = students.get('count', 0) + 1