Jupiter Can you guys do that Write and test a function to m


Jupiter. Can you guys do that ?
Write and test a function to meet the respective specification. squareEach(nums) function. nums is a list of numbers. The function modifies the list by squaring each entry. The function returns None. Test your solution using the following test() function: def test(): nums = list(range(15)) squareEach(nums) print(nums) test() when correctly implemented, the test() function will print: [0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196]

Solution

def squareEach(nums):
    print(\"Returns Each item in the list squared\")

    for i in list(range(len(nums))):
        nums[i]=nums[i]**2
  
    return nums

 Jupiter. Can you guys do that ? Write and test a function to meet the respective specification. squareEach(nums) function. nums is a list of numbers. The funct

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site