mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 07:12:31 +03:00
[python/py3] Updating set info (#3473)
Updating set info to be more descriptive and informative
This commit is contained in:
parent
884d2707d2
commit
cbcb987c53
@ -328,7 +328,8 @@ filled_dict["four"] = 4 # now, filled_dict["four"] => 4
|
|||||||
filled_dict.setdefault("five", 5) # filled_dict["five"] is set to 5
|
filled_dict.setdefault("five", 5) # filled_dict["five"] is set to 5
|
||||||
filled_dict.setdefault("five", 6) # filled_dict["five"] is still 5
|
filled_dict.setdefault("five", 6) # filled_dict["five"] is still 5
|
||||||
|
|
||||||
# Sets store ... well sets (which are like lists but can contain no duplicates)
|
# You can declare sets (which are like unordered lists that cannot contain
|
||||||
|
# duplicate values) using the set object.
|
||||||
empty_set = set()
|
empty_set = set()
|
||||||
# Initialize a "set()" with a bunch of values
|
# Initialize a "set()" with a bunch of values
|
||||||
some_set = set([1, 2, 2, 3, 4]) # some_set is now set([1, 2, 3, 4])
|
some_set = set([1, 2, 2, 3, 4]) # some_set is now set([1, 2, 3, 4])
|
||||||
|
Loading…
Reference in New Issue
Block a user