Write a method called fill that accepts an integer value as a parameter and replaces every value

Question:

Write a method called fill that accepts an integer value as a parameter and replaces every value in the list with that value. For example, if a variable called list initially stores [42, –7, 3, 0, 15] and the call of list.fill(2); is made, the list will be changed to store [2, 2, 2, 2, 2].

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: