cmp method in Python Dictionary | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

cmp method in Python Dictionary

This code is not working. Why ? It is same on internet everywhere without importing any modules. a = {1:11,2:22} b = {1:11,3:33} print(cmp(a,b)) OUTPUT: NameError: name 'cmp' is not defined

2nd Jun 2019, 4:33 PM
harshit
harshit - avatar
1 Answer
+ 9
cmp() does no longer exist in Python 3. https://stackoverflow.com/a/25675708/10083528
2nd Jun 2019, 4:41 PM
Anna
Anna - avatar