Hi,
Here’s the challenge.
I finally solved it but two things still puzzle me.
-
How/Why does the
range
function used in the solution automatically refer to thelst
list? How is the link made…I don’t get it?
I mean, in a much more complex algorithm, I can easily imagine possibly needing the range method all over the code so…how do we point the range function to the right portion of our code? Because I don’t see that link in the solution to this problem? Nothing in that range function refers to thelst
list, other than using thelen(lst)
to calculate the length of the list, but that just returns a number used to define the end of our range. -
In the solution, they hint to another way of solving this challenge but don’t explain it at all. So I was hoping someone could help here with this:
Another way to do this would be to iterate through all indices and use an if statement to see if the index you’re currently looking at is odd.
That was my whole problem with solving this challenge, both with the original solution and this one…how do you address working with the indices of a list and not their values? Because regardless what I used (loops, conditionals,…) they all used the value of the index and not the index number itself, i.e. it’s position in the list.
Thanks!