Sollicitatievraag bij Nokia

Whats the difference between list and dictionary in python?

Antwoord op sollicitatievraag

Anoniem

16 jul 2019

Both are python data structures that store elements .The difference is list is represented as follow l1 = [1,2,3," example"] where we can access list elements using indexing dictionary is represented with key ,value pairs like follow dict1 = {ïd": "123","name" : " Indu" ,"surname" :"petapalle"} the elements can be accessed like print dict1["name"] this will print " Indu"

1