Created
October 23, 2013 18:04
-
-
Save pgainda/7123566 to your computer and use it in GitHub Desktop.
If you don't pass a particular index to the list slice, Python will pick a default. The default for the starting index is the first element of the list; the default for the ending index is the final element of the list; and the default for the stride index is 1.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my_list = range(1, 11) # List of numbers 1 - 10 | |
#Every odd number | |
print my_list[::2] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment