-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwords.py
32 lines (25 loc) · 989 Bytes
/
words.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import random
import string
def load_words():
"""
this function help to load more word by updating word_list (list)
Example :-
word_list = ["learning", "kindness", "joy", "kiet", "good"] (old)
word_list = ["learning", "kindness", "joy", "kiet", "good" ,"hello"] (new)
"""
word_list = ["learning", "kindness", "joy", "kiet", "good","aside","asked"," askew" ,"aspen", "aspic", "assay", "asses" ,"asset" ,"aster" ,"astir" ,"atilt" ,"atlas" ,"atoll","atoms"," atone"]
# uncomment the below for testing
# WORDLIST_FILENAME = "words.txt"
# inFile = open(WORDLIST_FILENAME, 'r', 0)
# line = inFile.readline()
# word_list = string.split(line)
return word_list
def choose_word():
"""
word_list (list): list of words (strings)
this function return one random world from list
"""
word_list = load_words()
secret_word = random.choice(word_list)
secret_word = secret_word.lower()
return secret_word