title: List unchanged after called in a function
body: <p>I'm working on a Python exercise in which I will rotate a 2d vector counterclockwise by theta degree. Here is the function I wrote</p>
  
  <pre><code>import math
  def rotate(coordinate,theta):
      theta=math.radians(theta)
      x=coordinate[0]
      y=coordinate[1]
      coordinate[0]=x*math.cos(theta)-y*math.sin(theta)
      coordinate[1]=x*math.sin(theta)+y*math.cos(theta)
  
      return coordinate
  </code></pre>
  
  <p>where coordinate is a list that contains the x and y value of the vector.</p>
  
  <p>However, when I try to call this function in the following way, something weird happened.</p>
  
  <pre><code> points=[]   
   test=[1,0]   # a test vector
  
   #rotate the test vector 360 times
   for j in range(360):
     #print(rotate(test,j))
     points.append(rotate(test,j))
  
   #print the content of the vectors after rotation
   for item in points:
       print(item)
  </code></pre>
  
  <p>In the code above, I have a test vector [1,0] and I would like to rotate it 360 times, and the rotated vector will be add to the list "points". However, if I print the content of list "points", I got</p>
  
  <pre><code>[1.0000000000000002, -4.098804629038e-14]
  [1.0000000000000002, -4.098804629038e-14]
  [1.0000000000000002, -4.098804629038e-14]
  [1.0000000000000002, -4.098804629038e-14]
  [1.0000000000000002, -4.098804629038e-14]
  [1.0000000000000002, -4.098804629038e-14]
  [1.0000000000000002, -4.098804629038e-14]
  [1.0000000000000002, -4.098804629038e-14]
   ...
  </code></pre>
  
  <p>which suggests the vector has not been rotated at all! </p>
  
  <p>I know this error can be fixed in many ways, but I still don't quite understand why this happens. Could anyone give some explanations? Thank you.</p>