Question: 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
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 tuplo 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. .: # YOUR CODE HERE raise Not ImplementedError() 1 ): assert callable(square_all) assert isinstance(square_all([1, 2]), list) assert square_alli(2, 4)) = 14, 16) In 1: assert callable(square_all)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
