mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-24 10:01:38 +00:00
python set literals should be separated by comma
This commit is contained in:
parent
a6bcf5f8d7
commit
c51d0ec1a7
@ -228,7 +228,7 @@ empty_set = set()
|
|||||||
some_set = set([1,2,2,3,4]) # filled_set is now set([1, 2, 3, 4])
|
some_set = set([1,2,2,3,4]) # filled_set is now set([1, 2, 3, 4])
|
||||||
|
|
||||||
# Since Python 2.7, {} can be used to declare a set
|
# Since Python 2.7, {} can be used to declare a set
|
||||||
filled_set = {1 2 2 3 4} # => {1 2 3 4}
|
filled_set = {1, 2, 2, 3, 4} # => {1 2 3 4}
|
||||||
|
|
||||||
# Add more items to a set
|
# Add more items to a set
|
||||||
filled_set.add(5) # filled_set is now {1, 2, 3, 4, 5}
|
filled_set.add(5) # filled_set is now {1, 2, 3, 4, 5}
|
||||||
|
Loading…
Reference in New Issue
Block a user