Skip to content

Instantly share code, notes, and snippets.

@antongorshkov
Created April 25, 2016 12:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antongorshkov/1bcb77ef172dc27639b88ea662c6ddfb to your computer and use it in GitHub Desktop.
Save antongorshkov/1bcb77ef172dc27639b88ea662c6ddfb to your computer and use it in GitHub Desktop.
import pprint
with open('fruits') as f:
d = dict([x.rstrip(),1] for x in f)
fruit = raw_input('Enter fruit: ').title()
if fruit in d:
print('Got it!')
else:
print('No luck!')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment