1) 함수선언부
def function()
2) 함소호출부
function()
여기서 함수에 변수가 있을 경우, 함수선언부의 변수를 매개변수(parameter)
호출부의 변수를 인수(argument)라고 함
ex)
def greet(customer):
print(f'{}, hi'.format(customer))
greet('홍길동')
customer는 매개변수, '홍길동'은 인수
ex)
def printStrings(*string):
return len(string)
print(printStrings('a', 'b', 'c'))
결과값 : 3
ex)
def greeting(customer1, customer2='jake'):
print(f'{}, {}, hi'.format(customer1, customer2))
greeting('john')
결과값 : john, jake, hi