Skip to content

Instantly share code, notes, and snippets.

@delonnewman
Created January 12, 2012 07:54
Show Gist options
  • Save delonnewman/1599314 to your computer and use it in GitHub Desktop.
Save delonnewman/1599314 to your computer and use it in GitHub Desktop.
def is_in(val, list):
for item in list:
if item == val:
return True
return False
print is_in(1, [1, 2, 3]) # True
print is_in(5, [1, 2, 3]) # False
if is_in('r', ['r', 'R', 'rand', 'random', 'Rand', 'Random']):
print "It's random baby!!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment