diff options
author | Elijah Karari <eljhkrr@gmail.com> | 2015-10-31 09:56:06 +0300 |
---|---|---|
committer | Elijah Karari <eljhkrr@gmail.com> | 2015-10-31 09:56:06 +0300 |
commit | ab1acb1bb265577ea4f189d203ac35726f02970a (patch) | |
tree | a4830f1b257963e633b537061f10f84b818d5241 /python.html.markdown | |
parent | edfc99e198fd2e87802ea81d6779fbadfab64919 (diff) |
Updated tuple examples for clarity
Diffstat (limited to 'python.html.markdown')
-rw-r--r-- | python.html.markdown | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/python.html.markdown b/python.html.markdown index 541bd36d..b0add668 100644 --- a/python.html.markdown +++ b/python.html.markdown @@ -261,8 +261,9 @@ tup[:2] # => (1, 2) # You can unpack tuples (or lists) into variables a, b, c = (1, 2, 3) # a is now 1, b is now 2 and c is now 3 +d, e, f = 4, 5, 6 # you can leave out the parentheses # Tuples are created by default if you leave out the parentheses -d, e, f = 4, 5, 6 +g = 4, 5, 6 # => (4, 5, 6) # Now look how easy it is to swap two values e, d = d, e # d is now 5 and e is now 4 |