Question: Write a function called square _ all that takes an input called collection that you assume to be a list or tuple of numbers. This

Write a function called square_all that takes an input called collection that you assume to be a list or tuple of numbers.
This function should return a new list, which contains the square of each value in collection.
To do so, inside the function, you will define a new list, use a loop to loop through the input list, use an operator to square the current value, and use the append method to add this to your output list. After the loop, return the output list. (use python)Q2- Square Everything (0.5 points)
Write a function called square_all that takes an input called collection that you assume to be a list or tuple of numbers.
This function should return a new list, which contains the square of each value in collection.
To do so, inside the function, you will define a new list, use a loop to loop through the input list, use an operator to square the current value, and use the
append method to add this to your output list. After the loop, return the output list.
In []:
In []: # you can use this cell to test/execute/check your thinking (optional)
In []: :
In []: assert callable(square_all)
 Write a function called square_all that takes an input called collection

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!