mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-24 01:51:38 +00:00
Merge pull request #36 from jbub/fixsets
python set literals should be separated by comma
This commit is contained in:
commit
91283b4d8d
@ -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