Hello,
I am currently working on a Python 2 exercise called Modifying each element in a list in a function in the List and Functions section of this course.
I cannot understand the solution to this question. Can someone please provide a clear and logical explanation as to why the solution is this:
n = [3, 5, 7]
def double_list(x):
for i in range(0, len(x)):
x[i] = x[i] * 2
return x
Don’t forget to return your new list!
print double_list(n)
Thank you very much to all those who take the time to answer. Appreciate it!