Better way 10. 대입식을 사용해 반복을 피하라 fresh_fruit = { 'apple': 10, 'banana': 8, 'lemon': 5, } def make_lemonade(count): print(f'Making {count} lemons into lemonade') def out_of_stock(): print('Out of stock!') count = fresh_fruit.get('lemon', 0) if count: make_lemonade(count) else: out_of_stock() 위 코드에서 count 변수는 if 문의 첫 번째 블록 안에서만 쓰인다. if 앞에서 count를 정의하면 else 블록이나 그 이후의 코드에서 count 변수에 접근해야 할 필요가 있는 것 ..