Functions And It’s Types In Python3

1. Function With No Argument And No Return Value.

def display():
    print("hello")
    print("welcome")
    print("End")


display()
display()
display()
display()
display()

2. Function With Arguments And No Return Value.

def display(name):#formal arguments
    print("hello")
    print("welcome",name)
    print("End")


display("ranjan")#actual arguments
display("jiban")

3. Function With Arguments And With Return Value.

def addition(a,b):#formal arguments
    return(a+b)


print(addition(10,20))

c=addition(100,200)
print(c)

x=int(input("enter a value"))
y=int(input("enter b value"))
z=addition(x,y)#actual arguments
print("sum=",z)

4.Recursive Function.

def fact(n):
  if(n==1):
    return 1
  else:
    return n*fact(n-1)

a=int(input("enter a value"))
print(fact(a))

5.Default Arguments In Python3.

def bw(width,height,font='TNR'):
    print(width,height,font)




bw(350,500)
bw(350,500,"Arial")