In [1]:
def myfun():
    a=5
    b=10
    print a,b
myfun()
myfun()


5 10
5 10

In [2]:
a=1,2

In [3]:
b,c = a

In [4]:
l = [1,2,3,4]
def myfun(a):
    a.append(5)
myfun(l)
print l


[1, 2, 3, 4, 5]

In [6]:
l = [1,2,3,4]
def myfun(z):
    z.append(5)
myfun(l)
print z


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-6-478e5662b744> in <module>()
      3     z.append(5)
      4 myfun(l)
----> 5 print z

NameError: name 'z' is not defined

In [14]:
l = [1,2,3,4]
def myfun(a):
    #a=[1,2,3,4]
    a.append(5)
myfun(l)
print l


[1, 2, 3, 4]

In [8]:
a = l

In [9]:
print id(a), id(l)


56382448 56382448

In [11]:
a=[1,2,3,4]

In [12]:
print id(a), id(l)


56151256 56382448

In [15]:
def arth(a,b):
    print a+b
    print a-b
    print a*b
c=2
d=5
arth(c,d)
c=3
d=7
arth(c,d)
arth(2,8)


7
-3
10
10
-4
21
10
-6
16

In [17]:
def arth(a,b):
    c = a+b
    d =  a-b
    e = a*b
    return c,d,e
c=2
d=5
e,f,g = arth(c,d)
print e
print c,d


7
2 5

In [ ]: