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, 2019 in Python by Neel
• 3,020 points
732 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, 2019 by Arvind
• 3,050 points

Related Questions In Python

0 votes
1 answer

what is the use of // operator in Python? Can anyone explain?

Hi, @Roshni, It is a Floor Divisionoperator, which ...READ MORE

answered Jun 23, 2020 in Python by Gitika
• 65,770 points
2,310 views
+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,440 points
4,934 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
1,292 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
• 58,020 points
1,093 views
0 votes
2 answers
+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 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,464 views
0 votes
1 answer
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 23, 2019 in Python by Arvind
• 3,050 points
2,058 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, 2019 in Python by Arvind
• 3,050 points
1,641 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP