KnowledgeBoat Logo
|

Computer Science

Assertion (A): The pop() method can be used to delete elements from a dictionary.

Reasoning (R): The pop() method deletes the key-value pair and returns the value of deleted element.

  1. Both A and R are true and R is the correct explanation of A.
  2. Both A and R are true but R is not the correct explanation of A.
  3. A is true but R is false.
  4. A is false but R is true.

Python Dictionaries

1 Like

Answer

Both A and R are true and R is the correct explanation of A.

Explanation
The pop() method is used to delete elements from a dictionary. This method not only deletes the item specified by the key from the dictionary but also returns the deleted value.

Answered By

3 Likes


Related Questions