nerdexam
Python_Institute

PCEP-30-02 · Question #312

PCEP-30-02 Question #312: Real Exam Question with Answer & Explanation

The correct answer is D. 3. See the full explanation below for the reasoning.

Question

What is the expected output of the following code?
data = [1, 2, [3, 4], [5, 6], 7, [8, 9]]
count = 0

for i in range(len(data)):
 if type(data[i]) == list:
 count += 1

print(count)

Options

  • A6
  • BThe code is erroneous.
  • C9
  • D3

Community Discussion

No community discussion yet for this question.

Full PCEP-30-02 Practice