nerdexam
Python_Institute

PCEP-30-02 · Question #8

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

The correct answer is D. d.clear(). See the full explanation below for the reasoning.

Question

How would you remove all the items from the d dictionary? Expected output:
{}
Code:
d = {'A' : 1, 'B' : 2, 'C' : 3}

Options

  • Ad.del()
  • Bd.remove()
  • Cdel d
  • Dd.clear()

Community Discussion

No community discussion yet for this question.

Full PCEP-30-02 Practice