diff options
author | Divay Prakash <divayprakash@users.noreply.github.com> | 2018-10-26 02:35:15 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-26 02:35:15 +0530 |
commit | 30cdf4b25327e01c751db384e42692fd95178db1 (patch) | |
tree | a4aa41d8aabfd539f7fd452f100dadfe38254ee2 /python3.html.markdown | |
parent | 764d30947be5e1b675c1179149250417b63edcdc (diff) |
Fix tuple unpacking example in python3, closes #3130 (#3328)
Diffstat (limited to 'python3.html.markdown')
-rw-r--r-- | python3.html.markdown | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/python3.html.markdown b/python3.html.markdown index 7683bc60..c7fbf342 100644 --- a/python3.html.markdown +++ b/python3.html.markdown @@ -281,7 +281,8 @@ a, b, c = (1, 2, 3) # a is now 1, b is now 2 and c is now 3 # You can also do extended unpacking a, *b, c = (1, 2, 3, 4) # a is now 1, b is now [2, 3] and c is now 4 # Tuples are created by default if you leave out the parentheses -d, e, f = 4, 5, 6 +d, e, f = 4, 5, 6 # tuple 4, 5, 6 is unpacked into variables d, e and f +# respectively such that d = 4, e = 5 and f = 6 # Now look how easy it is to swap two values e, d = d, e # d is now 5 and e is now 4 |