172,986 views
22 votes
22 votes
In python, what is the difference between a dictionary and a set? How are they similar?

User Kedare
by
2.7k points

1 Answer

13 votes
13 votes

Answer:

"A set is an unordered collection. A dictionary is an unordered collection of data that stores data in key-value pairs."

Step-by-step explanation:

Set =>

Collection of non-repetitive elements.

Unordered

Unindexed

No way to change items.

Dictionary =>

Collection of key-value pairs.

Unordered

Indexed

Mutable

User Deepal
by
2.9k points