Passing arguments to Function in Python programming. Functions are used to divide a large program into sub-programs for easy control. All these sub-programs are called sub-functions of the program.
def fun(arg): #'fun()' is name of Function and passing here Argument to
print("This is "+ arg +" Function") #Parameter 'arg' and printing.
print("Before Calling Function")
fun("Parameterized") #calling and passing Argument to Parameter.
print("After Calling Function")
def fun(): #'fun()' is name of function.
print("This is Simple Function")
def fun1(a, b): #passing arguments here to parameters.
i = a #assigning 'a' value to 'i'.
j = b #assigning 'b' value to 'j'.
k = i + j #adding 'i' and 'j' values and assigning to 'k'.
#U also Direct write like 'k = a + b'.
print("The Sum is: ", k)
def fun2(): #'fun2()' is name of function.
print("This is Another Simple Function")
fun() #calling 'fun()' function.
fun1(5, 6) #calling and passing arguments to parameter.
fun2() #calling 'fun2()' function.
def fun(i, j): #passing here arguments to parameters.
print("The Passed i value is: ", i) #and printing.
print("The Passed j value is: ", j)
def fun2(x, y, z): #passing here arguments to parameters.
print("The Passed x value is: ", x) #and printing.
print("The Passed y value is: ", y)
print("The Passed z value is: ", z)
a = 5
b = 65
c = 'C'
fun(a, b) #calling and passing arguments to parameters.
fun2(a, b, c) #calling and passing arguments to parameters.
def set(name, roll, sec): #passing here arguments to parameters.
n = name
r = roll
s = sec
show(n, r, s) #calling and passing arguments to parameters.
def show(name, roll, sec): #passing here arguments to parameters.
print("My Name is: ", name)
print("My Roll Number is: ", roll)
print("My Class section is: ", sec)
print("Before Calling Functions")
set("HiLaLs", 12012, 'B') #calling and passing arguments to parameters.
print("After Calling Functions")