KnowledgeBoat Logo
|

Informatics Practices

What will be the output of the following Python code snippet?

d1 = { "amit" :40, "jatin" :45}
d2 = { "amit" :466, "jatin" :45}
d1 > d2
  1. True
  2. False
  3. Error
  4. None

Python Dictionaries

1 Like

Answer

Error

Reason — In Python, we cannot directly compare dictionaries using the > or < operators. Attempting to do so will result in a Error because dictionaries are unordered collections.

Answered By

2 Likes


Related Questions