Skip to content

Instantly share code, notes, and snippets.

@dwardu
Created July 9, 2013 12:24
Show Gist options
  • Save dwardu/5956945 to your computer and use it in GitHub Desktop.
Save dwardu/5956945 to your computer and use it in GitHub Desktop.
def does_haystack_contain_needle(haystack):
for thing in haystack:
if thing == 'needle':
return True
else:
return False
print does_haystack_contain_needle(['hay', 'hay', 'hay', 'hay', 'hay'])
print does_haystack_contain_needle(['hay', 'hay', 'hay', 'needle', 'hay', 'hay'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment