+ 1

Difference between sets and dictionaries in python ???

6th Jun 2020, 4:14 PM
Yuvraj Chodha
Yuvraj Chodha - avatar
2 Réponses
+ 3
Take a brief description: https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2464/ https://www.sololearn.com/learn/Python/2450/ Basically, sets are just containers of *unique* elements, while dictionaries - of unique key-value pairs.
6th Jun 2020, 4:19 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 2
You use sets if you do not want duplicates for example s={1, 3, 6, 6, 7} is the same as s={1, 3, 6, 7} and the elements of a set are not indexed which means that s[2] for example will produce an error .
6th Jun 2020, 4:26 PM
Hisham YUM 🇲🇦
Hisham YUM 🇲🇦 - avatar