Which method returns a view containing all keys of a Python dictionary?

Options

  • A. values()
  • B. keys()
  • C. items()
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

B. keys()

Detailed Explanation

Explanation: keys() returns a view of all dictionary keys.