A

Admin • 802.91K Points
Coach

Q. What is the output of: `d = {'x': 100, 'y': 200}; d['z'] = d.get('z', 300)`?

  • (A) {'x': 100, 'y': 200}
  • (B) {'x': 100, 'y': 200, 'z': 300}
  • (C) Error
  • (D) {'z': 300}

Explanation by: Admin
`get('z', 300)` returns 300 since 'z' doesn't exist, and assigns it.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.