DEV Community

Cover image for Write a loop that sets newscores to oldscores shifted once left, with element 0 copied to the end.

Write a loop that sets newscores to oldscores shifted once left, with element 0 copied to the end.

smithmchael550 on November 25, 2020

I got a problem with my textbook under the for-loop chapter. It’s saying something like this: Write a loop that sets newscores to oldscores shifte...
Collapse
 
coderlegi0n profile image
CoderLegion

As far as I can tell, the problem is that some numbers should be set to old score from newscore.
After it has relocated, o must be substituted for the initial value by moving it to the end.
In my programme, I first printed the oldScores, then sorted the values in the next for-loop, and then printed the newScores in the next for-loop. See the code here kodlogs.net/18/write-loop-that-set...