414,493 views
13 votes
13 votes
-2

Write a program that contains a function that takes in a 2D list and an integer as parameters. The integer represents the limit of the values inside the list. The function should change any value in the list that is greater than that limit to be equal to limit, and any values less than -limit to be equal to -limit. For example, if the limit is 200, it should change 250 to 200, it should change -300 to -200, and leave any values between -200 and 200 unchanged. Finally, the function should print the resulting list. Ask the user for 25 integers, put them in a 5x5 list, ask the user for the limit, then call the function and output the result.

User Souvik Sikdar
by
3.2k points

1 Answer

24 votes
24 votes

Answer:

The integer represents the limit of the values inside the list. The function should change any value in the list that is greater than Explanation:

User Vitorenesduarte
by
2.7k points