Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+5 votes

Can anyone help me with this one?

asked in CSC201 Spring 2021 by (1 point)

2 Answers

+2 votes

Take a look at the animation slides from a couple weeks ago, and also keep in mind the checkMouse feature. You'll likely use that quite a bit. Also while loops. Those are your friend here.

Edit: I was looking at 34, not 33, my bad.

What is question 33? I can't see it on mobile.

answered by (1 point)
+1

Write a function repeatElements which accepts two parameters, a list and an int, numRepeats. It modifies the list so that is has numRepeats of each element.

+1

You'll want to iterate backwards through each element of the list using a for loop, and use the insert function to add the desired number of each element into the list.

+2 votes

For this question, I use the moving backward strategy and the insert method.

answered by (1 point)
...