title: Python passing list into a function and return back to main
body: <p>I am taking 3 values from the users. Number1, Number2 and Power, considering Number1 and Number2 as a range of a list. Then I am trying to pass the list of the of numbers into a function as a parameter along with the power value as another parameter. Using the pow function to calculate the powers of each of the numbers in the list using a for loop. I want to store the results in the same list which was passed into this function and return back to the main function and print there. Now the question is, I assume i am trying the wrong approach since the output is not as expected. I declared another list (results) and store all the power results from the numbers list into it. Then asigned the results list to numbers list, so as to copy all the values in it. Now when i return the numbers list and print in the main function, it still shows the same values which were in the numbers list before it was sent to the function. Though when i try to print the list inside the function, it gives correct output. How am I wrong, and how should i correct it?</p>
  
  <pre><code>def powerList(numbers, power):
     print("In the function")
     print(numbers)
     print("Calculating powers")
  
     result = []
     for x in range(len(numbers)):
        result.append(pow(numbers[x], power))
  
     numbers = result
     return(numbers)
  
  def main():
     n1 = int(input("Input number1: "))
     n2 = int(input("Input number2: "))
     power =  int(input("Input power: "))
     numbers = [x for x in range(n1,n2+1)]
     print(numbers)
     print("Passed to the function powerList")
     powerList(numbers, power)
     print(numbers)
  
  main() 
  </code></pre>