function in the python or docstring

technical talkiess
0

  simple function in the python

def functionHelloWorld():
    print("Hello world")

parameterizsed function in the python

def sumofthenumber(a,b):
    print(a+b)

return type function in python

def squareOfthenumber(a):
    return a**a

calling the function simple function
    functionHelloWorld()
calling the parameterizsed function
sumofthenumber(2,2)

if you want to store the function value in the some varaible you can return the value to the function oter wise it's show None in the result
sumofthe = sumofthenumber(2,2)
print(sumofthe)


Avoid this type of the value you can retrn the value to the function this type of error not come
print(squareOfthenumber(2))



doc string in the python say's or definition of the function
def addTwonumber(a,b):
    """This is the docstring in the python. If you says its comment but no any comment in the starting function it's docstring in the python"""
    return a+b

if you want to access the  docstring in the python you use the following cammand
print(addTwonumber.__doc__)




Function in the python.
Parameterizsed function in the python.
Return Function in the python . What is the docstring in the python Function.
Access Docstring in the python function
Tags

Post a Comment

0Comments

Thanks you for commenting your questions. I will see question and respond you.

Post a Comment (0)