Which of the following is a collection in Python?
2026
Which of the following is a collection in Python?
- A.
int
- B.
float
- C.
bool
- D.
str
Attempted by 308 students.
Show answer & explanation
Correct answer: D
In Python, data types are categorized as scalar or collection types. Integers (int), floats (float), and booleans (bool) are scalar types that store single values. Strings (str) are sequences of characters and support iteration, containment checks, and length operations, making them a collection type. Therefore, the string is the correct answer.