#Program to demonstrate Local and Global Declaration
#variable declaration globally
i=0
print "Value of i in main", i
#define function
def f1():
k=0
i=50
print "Value of i after function call",i
#Function Call
f1()
#Program to demonstrate usage of local and global variable
for i in range(0,3):
print "Value of i is:", i
i=590
print "The Value of i is:", i
#Program to call function without parameters
def message():
print "Main Message"
print "Function Message"
message()
#Program to call function with parameter
#Defining function
def add(x,y):
z=0
z=x+y
return z
k=add(10,20)
#Result
print "The Value of k is ", k
#Program to write prototype of the function
k=0
#Defining in function
def f1(k):
k=k+100
return k
#Result
print "The value of i before call: ", k
print "The Value of i after call: ",(f1(k))
#Program to write prototype definition in main function
def fun(k):
k=k+10
return k
i=0
#Result
print "The i value before call %d\n"%(i)
print "The i value after call %d\n"%fun(i)