본문 바로가기
잡학다식/Python coding

[Python 기초] 함수(function)

by Little Boy 2023. 3. 21.

함수는 input을 받아 output을 return하는 기능을 하는 것이다.

Python에서는 함수는 다음과 같이 정의하여 사용할 수 있다.

def (함수명)(input):   # def Add(x1,x2)
	(함수내용)      #     y=x1+x2
	return (output)    #     return y

 

'잡학다식 > Python coding' 카테고리의 다른 글

[Python 기초] 조건/반복문  (0) 2023.03.21
[Python 기초] 연산자(Operator)  (0) 2023.03.21
[Python 기초] 자료형(Data type)  (0) 2023.03.21