Wednesday, December 8, 2021

Polymorphism in python

 polymorphism means one function with multiple forms. one function can act like multiple functions.

Example:

#polymorphism


print(len("hello"))


print(len([10,20,30]))



output:

5

3



#your defined  polymorphism


def poly_test(a,b,c=0):

    print(a+b+c)

    

poly_test(10,20)

poly_test(10,20, c=30)


output :

30

60

python classes

 class anil_test2:

    a = 10

    

    def ani_test():

        print(" This class inside function")

        

        

        

print(anil_test2)


python functions test1

 


def anil():

    print("testing the values")

    

anil()


def anil_test():

    print("testing is working")

    

    

anil_test()

python class topic video