Tuesday, June 23, 2020

Pyhton Function with Default Value

def ganga(a=4,b=5):
      return(a+b)
ganga(
ganga(10)
ganga(10,20)

)👆👇


python Function with Return Statement

def add(a,b):
    return(a+b)
def sub(a,b):
    return(a-b)
def factorial(a):
    f=1
    for i in range(1,a+1):
        f=f*i
    return(f)
c=add(9,7)+sub(7,5)+factorial(7)+sub(9,5)+add(3,4)+len("india")
print(c)




Python Function with example

def add(a,b):
    print(a+b)
def sub(a,b):
    print(a-b)
def factorial(a):
    f=1
    for i in range(1,a):
        f=f*i
        
    print(f)
x=add(5,4)
y=sub(9,8)
z=factorial(5)
print(x,y,z)