why I don't know '.count()'
How would you overcome that?
Semicolon can be used a separator but it's limited compared to other C-like languages.
I'm reading something about a semicolon being a seperator.
ok, I understand. But I see it in a few solutions, is there any stylistic reason someone would do that? Or is that a behavior that happens in other languages and is unneccesary in python but could be done if someone was inclined?
No reason at all. Someone submitted it first and all solutions without it got grouped with that solution.
why the semi colon? I'm a beginner
This comment is hidden because it contains spoiler information about the solution
You have a good point there, indeed.
I would measure it against a simple if index is even .. else loop, but that's probably not any faster. Thanks for the heads up!
if index is even .. else
IIRC, a slice has a time complexity of O(k) (with k == the number of items). So, going over two halves of the array are roughly equivalent to going over the array once. I imagine there is a bit of overhead for the stepping, but I doubt it's much. I'm really not sure how you'd optimize this code in pure python.
Not really best practice, because you traverse the array twice, but at least it's clear :-)
lol, my solution verbatim
Not really best practice, because you traverse the whole list, although in most cases it's not needed.