You have a row of alternating green and red bricks. It starts with the green brick and has an index of 0.
Then a red brick with the index 1 follows. Then again a green brick with index 2... and so on
You can't see colors. You can see only the index numbers and you were told, that the index 0 starts with a green brick.
Your task is the same.
You have a list with even and odd elements. Just read more about the slice notation / index access of sequences.
Two or one compact line code solves the problem.
Then a red brick with the index 1 follows. Then again a green brick with index 2... and so on
You can't see colors. You can see only the index numbers and you were told, that the index 0 starts with a green brick.
Your task is the same.
You have a list with even and odd elements. Just read more about the slice notation / index access of sequences.
Two or one compact line code solves the problem.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!