Issue
Need to compare two dictionaries help me out. Leave down the correct syntax if I doing it wrong, Thank you
Solution
Your syntax is correct. In your case the choice
is taken as dictionary 1 and week
is taken as dictionary 2. cmp
function is not defined in python 3 so you are getting an error . If you use same code in python 2 then your code will run without any error.
Here is the code in python 2.7:
>>> choice = {'fav': ['biryani', 'chow mein', 'tikka']}
>>> week = {'cook': ['rice', 'pulses', 'pualo', 'biryani']}
>>> cmp(choice, week)
1
Answered By - Manoj Thapa
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.