Last answered:

21 Nov 2023

Posted on:

12 Nov 2023


Confusion with terms index and element

In the exercise of this lesson the answer for "Access the second element of this tuple." is Cars[1]. But in the last exercise the third element was index 3. I'm very confused

1 answers ( 0 marked as helpful)
Posted on:

21 Nov 2023


Hi Laís!
Thanks for reaching out.


In the context of your question, the term "3rd position" can indeed be a bit ambiguous, as it depends on whether we're considering the position starting from 1 (as is common in everyday language) or starting from 0 (as is the norm in Python and most programming languages).

In Python, indexing starts at 0, so:

The 1st position is index 0.
The 2nd position is index 1.
The 3rd position is index 2.
However, in common language, when people refer to the "3rd position," they might actually mean the third element, which in Python would be at index 2.

If the exercise's solution is Numbers[3:], it suggests that they are using the Python convention of starting from 0. This would mean that Numbers[3:] is slicing from the 4th element (as we commonly say) to the end of the list. So, if the list is something like [10, 20, 30, 40, 50, 60], Numbers[3:] would yield [40, 50, 60].

Hope this helps.

Submit an answer