Last modified: Jan 10, 2023 By Alexander Williams
use a function in another function in Python
In this Tutorial, we'll learn how to use a function in another function.
First, we need to create a simple function that we'll use in another function.
def fun_1():
return "Hello fun_1"
Now, let's create another function core and using fun_1 inside of it.
def core():
#call the function
f1 = fun_1()
#print
print(f1)
Finally, let's call core function and see the result.
#call 'core' function
core()
result:
Hello fun_1