What is the use of '==' operator in dictionary in Python?

0 votes
Suppose I have two dictionaries y and z. So can I use '==' operator to compare them?
Jul 24 in Python by Neel
• 3,010 points
19 views

1 answer to this question.

0 votes

Yes you can use '==' operator to compare 2 dictionaries.

my_dict1 = {'name':'Jack', 'age': 26}
my_dict2 = {'name':'Jack', 'age': 26}
my_dict1 == my_dict2 # this will print true
mydict1['name'] == mydict2['name'] # this will print true
answered Jul 24 by Arvind
• 2,960 points

Related Questions In Python

+2 votes
3 answers

what is the practical use of polymorphism in Python?

Polymorphism is the ability to present the ...READ MORE

answered Mar 31, 2018 in Python by anto.trigg4
• 3,420 points
1,501 views
0 votes
1 answer

What is the use of raw_input function in Python?

raw_input fuction is no longer available in ...READ MORE

answered May 2, 2018 in Python by aayushi
• 750 points
108 views
0 votes
1 answer

What is the use of “assert” keyword in Python?

You can try the following in a ...READ MORE

answered Oct 15, 2018 in Python by Priyaj
• 56,900 points
81 views
0 votes
0 answers

what is the use of args and kwargs in python?

can you an example for each? READ MORE

May 10 in Python by Waseem
• 4,480 points
53 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 289 views
0 votes
1 answer

What is the purpose of else part in python exception handling?

When an error occurs, or exception as ...READ MORE

answered Aug 22 in Python by Arvind
• 2,960 points
22 views
0 votes
1 answer

What is the difference between str() and repr() functions in Python?

str() is mostly used to create output ...READ MORE

answered Jul 8 in Python by Arvind
• 2,960 points
83 views