diff options
author | SmuSmu <SmuSmu@users.noreply.github.com> | 2018-10-29 10:38:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-29 10:38:48 +0100 |
commit | 1372607b2ae40edf54fe4d04e3dfd3b789016c8e (patch) | |
tree | 95d30e2ae24ffaf6acb66f671b20e6b75713f0c3 /python.html.markdown | |
parent | 3a41a6006ff421b45ae46a521b900216ac28daf7 (diff) | |
parent | 9317733e2388ccafeea9c331443fe5f42b611390 (diff) |
Merge pull request #1 from adambard/master
ff
Diffstat (limited to 'python.html.markdown')
-rw-r--r-- | python.html.markdown | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/python.html.markdown b/python.html.markdown index 946cbc0c..df1ca6f2 100644 --- a/python.html.markdown +++ b/python.html.markdown @@ -7,6 +7,7 @@ contributors: - ["evuez", "http://github.com/evuez"] - ["asyne", "https://github.com/justblah"] - ["habi", "http://github.com/habi"] + - ["Rommel Martinez", "https://ebzzry.io"] filename: learnpython.py --- @@ -363,6 +364,12 @@ filled_set | other_set # => {1, 2, 3, 4, 5, 6} # Check for existence in a set with in 2 in filled_set # => True 10 in filled_set # => False +10 not in filled_set # => True + +# Check data type of variable +type(li) # => list +type(filled_dict) # => dict +type(5) # => int #################################################### @@ -502,9 +509,9 @@ all_the_args(1, 2, a=3, b=4) prints: # Use * to expand positional args and use ** to expand keyword args. args = (1, 2, 3, 4) kwargs = {"a": 3, "b": 4} -all_the_args(*args) # equivalent to foo(1, 2, 3, 4) -all_the_args(**kwargs) # equivalent to foo(a=3, b=4) -all_the_args(*args, **kwargs) # equivalent to foo(1, 2, 3, 4, a=3, b=4) +all_the_args(*args) # equivalent to all_the_args(1, 2, 3, 4) +all_the_args(**kwargs) # equivalent to all_the_args(a=3, b=4) +all_the_args(*args, **kwargs) # equivalent to all_the_args(1, 2, 3, 4, a=3, b=4) # you can pass args and kwargs along to other functions that take args/kwargs |