Modifying each element in a list in a function. what is wrong in my code?


#1


#2

@poorvi2,
-1
https://docs.python.org/2/library/functions.html#range
-2

the FUNCTION talk

def myFunc( param1, param2):
    # Begin of =myFunc= FUNCTION-BODY
    # this =myFunc= function- has 2 PARAMETERS param1 and param2
    # param1 and param2 PARAMETERS are used 
    # as -local- VARIABLES throughout the =myFunc= FUNCTION-BODY
    print( param1 + " and " + param2 )
    #End of =myFunc= FUNCTION-BODY

If you want to call/execute the myFunc function
you will have to add a pair of parentheses to myFunc
like
myFunc()
As the myFunc function was defined
as having 2 parameters
you have to provide 2 arguments
in our case 2 string VALUES "Alena" and "Lauren"
like
myFunc("Alena","Lauren")

some quotes from the outer-world:

**argument is the value/variable/reference being passed in,
parameter is the receiving variable used within the function/block**

OR

**"parameters" are called "formal parameters",
while "arguments" are called "actual parameters".**

-3
As you are using x as parameter
and you want to manipulate the elements
you will have to use x[i]


#3

def double_list(x) :
for i in range(0, len(x)):
x[i] = x[i] * 2
return x


#4

thanks @leonhard_wettengmx_n and @pry2015