1.

Define functions calling with example.

Answer»

Defining a function only gives it a specific name, specifies the parameters that are to be included in the function, and structures the blocks of code. Once the basic structure of a function is finalized, you can execute it by calling it from another function or directly from the Python prompt. Following is the example to call printme( ) function:

# !/usr/bin/py thon 

# Function definition

def printme(str): 

“This prints a passed string into this function”

 print str; 

return; 

# Now you can call printme function 

printme (“I’m first call to user defined function!”); 

printme (“Again second call to the same function”);

This will produce the following result:

I’m first call to user defined function! 

Again second call to the same function



Discussion

No Comment Found