How do you differentiate between declaring an empty dictionary and an empty set? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How do you differentiate between declaring an empty dictionary and an empty set?

(sorry I meant set all along)

23rd Jun 2016, 9:02 PM
Jay
Jay - avatar
3 Answers
+ 1
still learning, but wouldn't it be: dictionary= {} list = [] edit: based on your edit, you want empty set not empty list, from what I read there is no set literal defined like there is for dictionary, tuples, & lists. You would write: mySet = set()
24th Jun 2016, 12:06 AM
Colin Butler
Colin Butler - avatar
+ 1
A little correction to @Colin information, empty sets are not defined with brackets, but rather curly brackets with the name set prepended as below: For dictionary my_dictionary = {} For set my_set = set{}
21st Jul 2016, 7:10 PM
Benneth Yankey
Benneth Yankey - avatar
0
@jake not sure, but isn't a list an array (and a list nested in a list a more - dimensional array)?
24th Jun 2016, 6:48 AM
Bernd Stoeckel
Bernd Stoeckel - avatar