Passing arguments to Function in Python programming and using Return keyword to return value. Functions are used to divide a large program into sub-programs for easy control.
def bookie(func): #passing here argument.
func.count += 1 #adding 1.
def myfunc():
bookie(myfunc) #passing argument.
#Some other code goes here.
myfunc.count = 0
for i in range(10): #loop looping from 0 to 9.
myfunc() #calling function.
print(myfunc.count) #printing.
def fun(a, b): #passing here arguments to parameters.
c = a + b
return c #returning 'c' value.
print(fun(5, 6)) #calling and passing arguments to parameters and
#printing Returned value.
def fun(a, b): #passing here arguments to parameters.
c = a + b
return c #returning 'c' value.
val = fun(5, 6) #calling and passing arguments to parameters and
#assigning Returned value to 'val'.
print("The Returned value is: ", val) #and printing.