diff options
author | Adam Bard <github@adambard.com> | 2014-06-16 22:10:17 +0200 |
---|---|---|
committer | Adam Bard <github@adambard.com> | 2014-06-16 22:10:17 +0200 |
commit | cb974f0a3f4bdfc0a3a939fc46d9c5ebd7b566e3 (patch) | |
tree | 9c1950caeeef12c95811405b07ebd3ebca8b6a54 | |
parent | a404b09093d82b4317f5f1b986a132eb0fa812f8 (diff) | |
parent | 9f2929605470ba40b5dfe717554972f18f497826 (diff) |
Merge pull request #653 from xksteven/master
[python 3/en] fixed error in sets
-rw-r--r-- | python3.html.markdown | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/python3.html.markdown b/python3.html.markdown index 77811535..778076f8 100644 --- a/python3.html.markdown +++ b/python3.html.markdown @@ -238,7 +238,10 @@ empty_set = set() # Initialize a set with a bunch of values. Yeah, it looks a bit like a dict. Sorry. some_set = {1, 1, 2, 2, 3, 4} # some_set is now {1, 2, 3, 4} -# Add more items to a set +#Can set new variables to a set +filled_set = some_set + +# Add one more item to the set filled_set.add(5) # filled_set is now {1, 2, 3, 4, 5} # Do set intersection with & |