Skip to content

Joy of Python

Jeff Schnitzer edited this page Mar 12, 2017 · 1 revision

April 27, 2012

# first: grep '^......$' /usr/share/dict/words > words
f = open('words')
lines = f.readlines()
lines = [line.strip().lower() for line in lines]
letters = 'ecmlobkidepx'

def hasall(line):
	llist = list(letters)
	for letter in list(line):
		try:
			llist.remove(letter)
		except:
			return False
	return True

for line in lines:
	if hasall(line):
		print(line)

Can you guess what game I'm playing?

original