Question: Write a functionincrement(L, x)to add x to each item of the list L! The function should change the list L in place. It should not

Write a functionincrement(L, x)to add x to each item of the list L!

The function should change the list L in place. It should not return anything.

Use the docstring """Changes list L in place by adding x to each item""".

Do not change the main program. Expected output:

 
Before: [1, 2, 3, 4, 5]
After : [11, 12, 13, 14, 15] 

# Main program (do not change): nums = [1, 2, 3, 4, 5] print("Before:", nums) increment(nums, 10) print("After :", nums)

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!