diff options
author | Stanley Lim <slim679975@gmail.com> | 2019-11-21 10:54:24 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-21 10:54:24 -0500 |
commit | 2b1e1cca08eac0d4dc8f685dbe98d80683ca9d3a (patch) | |
tree | 460bb7d5cbc1141f8e710e3704f6d03dc25ea193 /python.html.markdown | |
parent | d4c5ff14cc8a0717f68746b4fe84cfb4efbdecf6 (diff) | |
parent | f1d03b0318a43441bb96bfdaabbd914eaa985879 (diff) |
Merge pull request #1 from adambard/master
Merging from master.
Diffstat (limited to 'python.html.markdown')
-rw-r--r-- | python.html.markdown | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/python.html.markdown b/python.html.markdown index df1ca6f2..0cc33a80 100644 --- a/python.html.markdown +++ b/python.html.markdown @@ -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", 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() # 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]) @@ -661,7 +662,7 @@ i.age # => raises an AttributeError # You can import modules import math -print math.sqrt(16) # => 4 +print math.sqrt(16) # => 4.0 # You can get specific functions from a module from math import ceil, floor |