forked from ekisaame/python_tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdef.py
More file actions
35 lines (28 loc) · 604 Bytes
/
def.py
File metadata and controls
35 lines (28 loc) · 604 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
def sum():
print "sum function with no arguments"
a=2
b=3
c= a+b
print "sum is {0}".format(c)
sum()
def summation(a,b):
print "sum function with arguments"
c=a+b
print "sum is {0}".format(c)
summation(5 , 6)
def sumReturn(a,b):
print "sum function with arguments"
c=a+b
return c
value =sumReturn(2 ,3)
#global variables
global_name = "allan"
def nameFun():
print("global name is : "+global_name)
local_name= "alex"
print("local name is : "+ local_name)
global me
me ="locally defined global variable"
print me
nameFun()
print me