Dictionaries | SoloLearn: Learn to code for FREE!



a={1, 2} What does it mean? If i try to do "print(a[1])", there's error. I thought, that this script means "0" as value and 1,2 as keys(a={1:0,2:0}), but if it was true, there wouldn't be any error. Help

9/4/2018 6:12:40 PM


4 Answers

New Answer


Because "a" is a set and set object does not support indexing dictionary synax is like this: {key: value, ...}


https://www.programiz.com/python-programming/set https://www.w3schools.com/python/python_dictionaries.asp


Mert Yazıcı "set" is one of types of data or "a" is dictionary or what? Sorry, can you explain it again, please


Mert Yazıcı thaks!