summaryrefslogtreecommitdiff
path: root/doc/data/messages/t/too-many-try-statements/good.py
blob: faea966a15084fc1c69f83a483742293ccf856b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
FRUITS = {"apple": 1, "orange": 10}


def pick_fruit(name):
    try:
        count = FRUITS[name]
    except KeyError:
        return

    count += 1
    print(f"Got fruit count {count}")