nerdexam
Python_Institute

PCEP-30-02 · Question #160

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

The correct answer is A. ace. See the full explanation below for the reasoning.

Question

What is the expected output of the following code?
def func(data):
 for d in data[::2]:
 yield d

for x in func('abcdef'):
 print(x, end='')

Options

  • Aace
  • Bbdf
  • Cabcdef
  • DAn empty line.

Community Discussion

No community discussion yet for this question.

Full PCEP-30-02 Practice