{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Section2Problems 3

# Section2Problems 3 - o Write a method mirror that doubles...

This preview shows pages 1–2. Sign up to view the full content.

o. Write a method mirror that doubles the size of a List of integers by appending the mirror image of the original sequence to the end of the 1ist. The mirror image is the same sequence of values in reverse order. For example, if a variable called list stores Lhis seguence of values: [1, 3, 2, 7] and we make the following call: list.mirror ( ) ; then it shouLd store the fol-lowing values after the call: [1, 3, 2,'7, 7t 2, 3, 1] Notice that it has been doubled in size by having the original sequence appearing in reverse order at the end of the list. You may not make assumptions about how many elements are in the list 7. Write a method 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 of that integer. For example, if a variable called Iist stores this

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 2

Section2Problems 3 - o Write a method mirror that doubles...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online