Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (55.6k points)

Is Dictionary mutable in Python?

1 Answer

0 votes
by (119k points)

Dictionaries are mutable in Python because we can add, delete, and changed the data values even after creating.

Here are examples of how to add, delete, or change the data entries of the dictionary:

#Create a dictionary

grades = {'arthur':90, 'belle':60, 'charles':80}

To add or change elements:

grades['charles'] = 85 # Change the value of Charles

grades['doug'] = 70    # adds a new entry

To remove entries we can use

del grades['belle']

If you want to get proficient in Python, I recommend this Intellipaat’s Python Course.

Also, watch this Python Tutorial on sets and dictionaries:

Related questions

0 votes
1 answer
0 votes
1 answer
asked Nov 26, 2020 in Python by Rekha (2.2k points)
0 votes
1 answer
asked Feb 4, 2021 in Python by Rekha (2.2k points)
0 votes
1 answer
asked May 30, 2020 in Python by Sudhir_1997 (55.6k points)
0 votes
1 answer
asked Feb 20, 2021 in Python by laddulakshana (16.4k points)

Browse Categories

...