mirror of
https://github.com/RussellChamp/tilde-projects.git
synced 2026-10-28 00:22:34 +00:00
Added some puzzle thingsy
This commit is contained in:
1 parent
746f1091bb
commit
4fa28ac636
4 files changed
+43
-1
No files matched your search
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/python
|
||||
import random
|
||||
import inflect
|
||||
|
||||
p = inflect.engine()
|
||||
dictionary = "/usr/share/dict/american-english-small"
|
||||
|
||||
def get_puzzle():
|
||||
dict_words = [word.rstrip() for word in open(dictionary).readlines() if "'" not in word]
|
||||
words = random.sample(dict_words, 3)
|
||||
key = random.randrange(0,3) #get values 1-3
|
||||
puzzle = "When alphebetized, what is the " + p.ordinal(p.number_to_words(key+1)) + " in " + ", ".join(words)
|
||||
words.sort()
|
||||
answer = words[key]
|
||||
return [answer, puzzle]
|
||||
Reference in new issue
Block a user