Tuesday, December 22, 2020

python day 16 functions

 # -*- coding: utf-8 -*-

"""

Created on Wed Dec 23 07:27:55 2020

day :16

session: functions continue


@author:anil


def father(a):

    

    print("father",a)

    

    def son(a):

        b=20

        print("son",a,b)

        

    son(a)

    #father(b)

    

    

father(10)



def father(a):

    

    print("father",a)

    

    def son(a):

        b=20

        print("son",a,b)

        return b

        

    c=son(a)

    print("father",c)

    #father(b)

    return c

    

    

a=father(10)

print(type(a),a)



def father(a):

    

    print("father",a)

    

    def son(b):

        b=30

        print("son",b)

        return b

        

    c=son(a)

    

    



father.son(20)


def father(a):

    

    print("father",a)

    

    def son(b):

        b=30

        print("son",b)

        return b

        

    c=son(a)

    

    


father(3)



def square_root():

    print("square root")


def triangle(a):

    side_of_triangle= a

    

    def perimeter(side_of_triangle):

        perimiter_value=3*side_of_triangle

        

        print("perimeter:",perimiter_value)

        

    def semi_perimeter(side_of_triangle):

        semi_peri_value=((3*side_of_triangle))/2

        print("semiperimeter:",semi_peri_value)

        

       

    

    perimeter(a)

    semi_perimeter(a)

        

    


triangle(30)

square_root()

"""


def square_root(a):

    

    #num1,num2=equal

    #number1 *number2= given value

    i=1

    

    num1=i

    num2=a

    j=1

    print(j)

    

    for j in range(i):

        j=j+1

        print(j)

        rem=num2/j

        i=i+1

        print(i)

    

    if num1==rem:

        

        print("square root",num1)

    else:

        print("not given")

    

square_root(100)


























No comments:

Post a Comment

python class topic video