def fun1(a):
for i in range(len(a)):
a[i] = a[i] * a[i]
return a
def fun1(a): for i in range(len(a)): a[i] = a[i] * a[i] return a
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It takes an array as parameter and returns the same array with each member squared.
EDIT:
Since you modified your question from ‘What does this function do’ to ‘What is some code to execute this function’, here is an example:
The output will be:
Because the function modifies the list in place, test1 is also modified.