Why so many challenges feature modifying an array while iterating? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why so many challenges feature modifying an array while iterating?

I've been under the impression that Sololearn is an app with educational purposes. If so, we should promote safe and healthy development practices. Modifying the list/array while iterating through it is neither safe nor healthy. So why exactly challenge questions (I'm talking about Python in particular) featuring this outright pernicious practice are approved?

28th Apr 2019, 8:29 PM
Nick Slavsky
Nick Slavsky - avatar
5 Answers
+ 4
Seeing those type of questions made me ask myself: "How /Why does this work?". That's how I found out it wasn't good practice to do so.
28th Apr 2019, 8:40 PM
Diego
Diego - avatar
+ 6
Those questions in challenges are just trying to confuse you, well not all of them, but you will find some for sure
29th Apr 2019, 2:01 AM
voja
voja - avatar
+ 4
They're probably just there as a test of aptitude rather than to promote best practice.
28th Apr 2019, 10:13 PM
Sonic
Sonic - avatar
+ 3
Anna What's the point of coding if your functions don't get overwritten and your program doesn't work as expected?
28th Apr 2019, 9:30 PM
Diego
Diego - avatar
+ 2
They promote using "list" as a name for a list, too 😤
28th Apr 2019, 9:00 PM
Anna
Anna - avatar