21 Nov 2023

Posted on:

12 Nov 2023

0

# Resolved:What do you mean when you ask for the position of a list element?

In the exercise theres this question: "Using slicing, extract all the elements from the list from the 3rd position onwards."

Wouldn't the third position be number 50? therefore index 2.

In the suggested solution the answer is Numbers[3:].

The question has become dubious.

Instructor
Posted on:

21 Nov 2023

0

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.
Best,
Tsvetelin