First post. I was doing the lists advanced code challenge and was quite pleased to have worked out what I need to do on my own. The way the code should be written that I came up with matched the way the code was written in the Code Academy solution. However when writing the code, I have written it in a slightly different way to the solution code. To my eyes they should do exactly the same thing but when I run the function with a list as the argument, my code gives the wrong answers or an index error and I can’t figure out why or what is different between our codes to produce the wrong result for my version? See below, my code is on the right.
To my eyes, even though written slightly differently they should be exactly the same or at least I can’t figure out where the bug in my code lies. Thanks in advance for the help!