Question: in python Write a function called list_powers . This function will take a list, and return a new list where each element is exponentiated to

in pythonin python Write a function called list_powers . This function will take

Write a function called list_powers . This function will take a list, and return a new list where each element is exponentiated to a specified power. Input(s): - collection - collection of numbers - power - int, default value: 2 Output(s): - power_list - list of numbers Procedure(s): - Initialize an empty list to be filled and returned - Loop through each element in the input collection - Take the value to the power specified in power - Append the result to the output list - Return the list of powers ] : ] : assert callable(list_powers) assert type ( list_powers ([1,2]))== list assert list_powers ((2,4))=[4,16]

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!