summaryrefslogtreecommitdiff
path: root/main.py
blob: 997b1e59cd7937ba51cdea63a68ff19dc1ea0041 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env python3
import sys

try:
	word_num = int(sys.argv[1])
except IndexError:
	word_num = None

WORDLIST_FILE_PATH = "corncob_lowercase.txt"

with open(WORDLIST_FILE_PATH, "r") as wordlist_file:
	valid_words = set([word[0].upper() + word.rstrip()[1:] for word in wordlist_file.readlines() if word.startswith("d")])

sys.stdout.write("Dungeons & Dragons")
for word in valid_words:
	if word_num is not None:
		if word_num <= 0:
			break
		word_num -= 1
	sys.stdout.write(" & " + word)
print()