Skip to content

Instantly share code, notes, and snippets.

@imsickofmaps
Created April 29, 2013 12:32
Show Gist options
  • Save imsickofmaps/5481335 to your computer and use it in GitHub Desktop.
Save imsickofmaps/5481335 to your computer and use it in GitHub Desktop.
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"
@confluence
Copy link

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