summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAdam Bard <github@adambard.com>2018-08-23 22:26:20 -0700
committerGitHub <noreply@github.com>2018-08-23 22:26:20 -0700
commit7cc01d69c35af0600002fb5eaafecf6237621025 (patch)
tree6f16a7ad23a19ba31ffeb9d05d938cf08c240cc1
parent84470bdd1c37d164fa9854dd974b4002085845b6 (diff)
parent04de3a348ab825f3b34eb38d07dcb3cdfc6feb7a (diff)
Merge pull request #3180 from robertofd1995/patch-1
Python3 Clarification about sets
-rw-r--r--python3.html.markdown3
1 files changed, 3 insertions, 0 deletions
diff --git a/python3.html.markdown b/python3.html.markdown
index d6cfbf59..b378a8c6 100644
--- a/python3.html.markdown
+++ b/python3.html.markdown
@@ -7,6 +7,7 @@ contributors:
- ["Zachary Ferguson", "http://github.com/zfergus2"]
- ["evuez", "http://github.com/evuez"]
- ["Rommel Martinez", "https://ebzzry.io"]
+ - ["Roberto Fernandez Diaz", "https://github.com/robertofd1995"]
filename: learnpython3.py
---
@@ -352,6 +353,8 @@ valid_set = {(1,), 1}
# Add one more item to the set
filled_set = some_set
filled_set.add(5) # filled_set is now {1, 2, 3, 4, 5}
+# Sets do not have duplicate elements
+filled_set.add(5) # it remains as before {1, 2, 3, 4, 5}
# Do set intersection with &
other_set = {3, 4, 5, 6}