프로그래밍 언어/Python

함수 내에서 또 다른 함수 호출

ruby-jieun 2023. 1. 7. 23:16

 

함수 내에서 또 다른 함수 호출

 


 

 

또 다른 함수 호출

  • 함수 내에서 또 다른 함수를 호출할 수 있다.
def fun1():
    print('fun1 호출!')
    fun2()

def fun2():
    print('fun2 호출!')
    fun3()

def fun3():
    print('fun3 호출!')


fun1()
fun1 호출!
fun2 호출!
fun3 호출!

 

pass 사용

  • pass를 이용해서 실행문을 생략할 수 있다.
def printTodayWeather():
    pass

def printTomorrowWeather():
    pass

printTodayWeather()
printTomorrowWeather()