functions_.txt
changeset 122 ed29ffa37cdc
parent 106 3451e2b9002e
equal deleted inserted replaced
121:331c5fdc06d4 122:ed29ffa37cdc
     7 
     7 
     8 Lets look at how to write functions by writing one out .
     8 Lets look at how to write functions by writing one out .
     9 
     9 
    10 We have given the function the name signum . Essentially what it does is that based on whether the no is 0 , negative or positive , it returns 0 , -1 and +1 respectively . In this case it recieves value of the no in variable r .    
    10 We have given the function the name signum . Essentially what it does is that based on whether the no is 0 , negative or positive , it returns 0 , -1 and +1 respectively . In this case it recieves value of the no in variable r .    
    11 
    11 
    12 In the beginning of the function you can see a triple quoted string . This is called a docstring . You can write some documentation related to your function. In this you can have the function parameters and what it returns . A python function returns a value by using the keyword return .
    12 In the beginning of the function you can see a triple quoted string . This is called a docstring. You can write some documentation related to your function. In this you can have the function parameters and what it returns. A python function returns a value by using the keyword return.
    13 
    13