jweinst1
6/23/2015 - 9:43 PM

word listing module.py

word listing module.py

alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
vowels = ['a', 'e', 'i', 'o', 'u', 'y']

def words_of_len_3():
	return [x + y + z for x in alphabet for y in alphabet for z in alphabet]
def words_of_len_4():
	return [w + x + y + z for w in alphabet for x in alphabet for y in alphabet for z in alphabet]
def words_of_3_with_vowel():
	voweled, words = [], words_of_len_3()
	for x in words:
		if x[1] in vowels:
			voweled.append(x)
	return voweled
	
def words_of_3_with_ing():
	return [x + y + z + 'ing' for x in alphabet for y in vowels for z in alphabet]
def custom_3_ing_words(letters): #returns list of words that have one of the letters
	custom = []
	if all == None:
		for x in words_of_3_with_ing():
			for l in letters:
				if l in x:
					custom.append(x)
	return custom
def alphabet_range(n):
	return ''.join(alphabet[0:n-1])