diff options
| author | Adam Bard <github@adambard.com> | 2013-11-11 21:50:37 -0800 | 
|---|---|---|
| committer | Adam Bard <github@adambard.com> | 2013-11-11 21:50:37 -0800 | 
| commit | 385035b07a1df13f9276a58adf6deeb3cbe9a1a9 (patch) | |
| tree | cb84c8bea1e98a4256400c9587162d4d7250cf43 | |
| parent | 5111009611d6c8ff2b177514bf69caf5fd2a6c51 (diff) | |
| parent | eb8afb2ff27e3dba477f9ab7257d4b13e55718b1 (diff) | |
Merge pull request #406 from aminbandali/pythontemp
[python/en] reverting a list using slices
| -rw-r--r-- | python.html.markdown | 3 | 
1 files changed, 3 insertions, 0 deletions
| diff --git a/python.html.markdown b/python.html.markdown index 08e68407..50c4e63f 100644 --- a/python.html.markdown +++ b/python.html.markdown @@ -2,6 +2,7 @@  language: python  contributors:      - ["Louie Dinh", "http://ldinh.ca"] +    - ["Amin Bandali", "http://aminbandali.com"]  filename: learnpython.py  --- @@ -159,6 +160,8 @@ li[1:3] #=> [2, 4]  li[2:] #=> [4, 3]  # Omit the end  li[:3] #=> [1, 2, 4] +# Revert the list +li[::-1] #=> [3, 4, 2, 1]  # Remove arbitrary elements from a list with "del"  del li[2] # li is now [1, 2, 3] | 
