nerdexam
Python_Institute

PCEP-30-02 · Question #299

Which of the code snippet below will print the following to the monitor? Paul Mary Jane

The correct answer is A. data = ['Peter', 'Paul', 'Mary', 'Jane'] for d in data: if len(d) == 4: print(d). See the full explanation below for the reasoning.

Question

Which of the code snippet below will print the following to the monitor? Paul Mary Jane

Options

  • Adata = ['Peter', 'Paul', 'Mary', 'Jane'] for d in data: if len(d) == 4: print(d)
  • Bdata = ['Peter', 'Paul', 'Mary', 'Jane'] for d in data: print(d)
  • Cdata = ['Peter', 'Paul', 'Mary', 'Jane'] data = data[1:] for d in data: print(d)
  • Ddata = ['Peter', 'Paul', 'Mary', 'Jane'] for d in data: if len(d) != 4: print(d)

How the community answered

(28 responses)
  • A
    71% (20)
  • B
    7% (2)
  • C
    4% (1)
  • D
    18% (5)

Community Discussion

No community discussion yet for this question.

Full PCEP-30-02 Practice