title: Local and Global lists in Python
body: <p>Please help me as I am new to python
  when I call this function the original value of <code>list1</code> changes</p>
  
  <pre><code>def mystery(list1):
    list1[0] , list1[1] = list1[1], list1[0]
  
  list1 = [7,82,44,23,11]
  mystery(list1)
  print(list1) #prints [82, 7, 44, 23, 11]
  </code></pre>
  
  <p>how it can change the value of global <code>list1</code>
  if I change my function to</p>
  
  <pre><code>def mystery(list1):
    list1 = list1 + list1[2:5]
  </code></pre>
  
  <p>then I am getting the global value of <code>list1</code> and not the updated one.</p>