451,446 views
31 votes
31 votes
Which of these collections defines a LIST? ["apple", "banana", "cherry"] {"apple", "banana", "cherry"} {"name": "apple", "color": "green"} ("apple", "banana", "cherry") Next ❯

User Cos
by
2.4k points

1 Answer

21 votes
21 votes

Answer:

["apple", "banana", "cherry"]

Step-by-step explanation:

In programming lists are defined by using square brackets. Curly brackets are used to define sets or dictionaries. Dictionaries are similar to lists but are not really considered lists since they use a key: value system unlike lists. Parenthesis in programming are used to define tuples or in some languages object literals with curly brackets inside. A list uses only square brackets, and depending on the language can either contain elements of the same type of different types. Therefore, the only correct example of a LIST in this question would be

["apple", "banana", "cherry"]

User Kevin Smyth
by
3.3k points