Created
April 29, 2013 12:32
-
-
Save imsickofmaps/5481335 to your computer and use it in GitHub Desktop.
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
choices = ["totes", "cool", "NSFW", "awesome"] | |
count = 0 | |
for choice in choices: | |
count +=1 | |
if count == 1: | |
print "I'm the first" | |
elif count == len(choices): | |
print "I'm the last" | |
else: | |
print "I'm in the middle somewhere" |
choices = ["totes", "cool", "NSFW", "awesome"]
for count, choice in enumerate(choices):
if count == 1:
print "I'm the first"
elif count == len(choices):
print "I'm the last"
else:
print "I'm in the middle somewhere"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You will need extra conditionals for the first/last depending on your use case.