+ 6

What is the difference between dictionary and list & dictionary and tuple?

I'm very confused about dictionary. Can anyone please make me clear about dictionaries?

24th Aug 2019, 11:24 AM
Pratibha Bharti
Pratibha Bharti - avatar
5 Respostas
+ 5
Dictionary: containd key-value pairs example: {"name": "Simon", "age": 20} List: containd ordered values example: ["name", "age] Tuples: immutable, it cannot be changed example: ("name", "age")
24th Aug 2019, 11:28 AM
Airree
Airree - avatar
+ 3
Thanks Airree
24th Aug 2019, 11:29 AM
Pratibha Bharti
Pratibha Bharti - avatar
+ 3
Dictionaries are not commonly used, at least to my knowledge. However there are some code that require unique key value pairs as a necessity. They wont fuction otherwise. I dont remember where right now but ı do remember it contains web.
24th Aug 2019, 12:15 PM
Tugay Mandal
24th Aug 2019, 1:58 PM
Seb TheS
Seb TheS - avatar
+ 2
Airree Pratibha Bharti although the Tuple is immutable, if the element in a Tuple is itself a mutable type like a List, its nested contents can be changed.
14th Jan 2020, 5:47 AM
Paul K Sadler
Paul K Sadler - avatar