53.0k views
2 votes
What is wrong with the following attempt to initialize a list?

data = ["hockey", 4, False]

Select one:

a.
You can't mix different types of data in a single list


b.
You should be using parentheses ( ) to surround the items in a list


c.
"data" is not a valid variable name


d.
Nothing; this will work correctly

User Vlince
by
8.1k points

1 Answer

2 votes

Final answer:

The attempt to initialize the list is incorrect because it contains different types of data.

Step-by-step explanation:

Option a.

The attempt to initialize the list is incorrect because it contains different types of data. In a list, all elements should typically be of the same data type.

For example, if you want to create a list of strings, you would initialize it like this:

data = ['hockey', 'football', 'tennis']

Having different data types in a single list can cause problems when working with the list, so it is generally recommended to keep the data types consistent within a list.

User Himalaya Garg
by
7.4k points