For example if a variable called list stores 18 7 4 24 11


Write a method called stretch that takes an integer n as a parameter and that increases a list of integers by a factor of n by replacing each integer in the original list with n copies of that integer. For example, if a variable called list stores [18, 7, 4, 24, 11] and we make the call of list.stretch(3); the list should be changed to store [18, 18, 18, 7, 7, 7, 4, 4, 4, 24, 24, 24, 11, 11, 11]. If n is zero or negative, the list should become empty.

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: For example if a variable called list stores 18 7 4 24 11
Reference No:- TGS02209460

Expected delivery within 24 Hours