2일차 - 190921 python
함수¶ ex1¶ In [1]: def add_start_to_end(start, end): return sum([_ for _ in range(start, end+1)]) print(add_start_to_end(2, 8)) 35 ex2¶ In [2]: def get_abbr(arr): return [ _[:3] for _ in arr] print(get_abbr(['Seoul', 'Daegu', 'Kwangju', 'Jeju'])) ['Seo', 'Dae', 'Kwa', 'Jej'] ex3¶ In [3]: def square(x): return x**2 f = lambda x: x**2 print(square(2)) print(f(2)) 4 4 ex4¶오류 원인 : 함수가 선언된 후 사용해야 함 파이썬..