135k views
0 votes
___ always returns an object of the same class as the original and can be used to select more than one element (one exception).

A. $
B. []
C. [[
D. None of the above

User Jahson
by
7.6k points

1 Answer

3 votes

Final answer:

The correct answer is B. []

Step-by-step explanation:

The correct answer is B. [].

In Python, the [] notation is used to create a list. Lists are used to store multiple elements in a single variable. When selecting elements from a list using indexing (e.g., my_list[0]), the result is always an object of the same class as the original list. For example, if the original list contains strings, the selected element will also be a string.

Here's an example:

  1. my_list = ['apple', 'banana', 'cherry']
  2. selected_element = my_list[1]
  3. The value of selected_element will be 'banana', a string object.
User AttilaTheFun
by
8.1k points

No related questions found