0% found this document useful (0 votes)
2 views11 pages

Understanding Python Dictionaries

The document explains the characteristics of dictionaries in programming, highlighting that they are unordered collections with mutable and immutable types. It discusses the differences between the clear function and the del statement, as well as the implications of changes in mutable versus immutable types. Additionally, it outlines the requirements for dictionary keys and values, noting that keys must be immutable while values can be of any type.

Uploaded by

rishi274r
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views11 pages

Understanding Python Dictionaries

The document explains the characteristics of dictionaries in programming, highlighting that they are unordered collections with mutable and immutable types. It discusses the differences between the clear function and the del statement, as well as the implications of changes in mutable versus immutable types. Additionally, it outlines the requirements for dictionary keys and values, noting that keys must be immutable while values can be of any type.

Uploaded by

rishi274r
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

DICTIONARY ASSIGNMENT

by Devrishi Mallick
1.
A dictionary is termed an unordered collection because its elements are not stored in a specific sequence like a list or a string
2.
the clear function removes all of the key value pairs but the del statement deletes the entire dictionary from the memory
3.
for the immutable type changes to the copy of the original doesnot affect the original because changes creates an entirely new dict

for the mutable type chamges caused to the copy is also seen in the original because both share the same memory location or id
4.
syntax error due v1
5.
6.
a. counts[word]

b.my_dict[[4, 2, 1]] = 10 lists are mutable


7.
a. 1

[Link] as two keys cant be accessed at the same time


8.
9.
10.
for the dict values can be of any type they can be muttable or immutable

for the dict keys they must be immutable like int float string and tuple

You might also like