-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.py
30 lines (24 loc) · 875 Bytes
/
run.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
import random as r
import tts # tts.py
import urllib3
# To disable the error below.
# InsecureRequestWarning: Unverified HTTPS request is being made to host 'translate.google.com'.
# Adding certificate verification is strongly advised.
# See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
# InsecureRequestWarning,
urllib3.disable_warnings()
def pick_word():
file = open('wordlist.txt', 'r')
word_list = file.readlines()
i = r.randint(0, len(word_list))
tts.convert(word_list[i])
return word_list[i]
end_of_game = False
while not end_of_game:
spell_out = pick_word()
userInput = input(f"{len(spell_out) - 1} letter word\nEnter Here: ")
if spell_out.strip('\n') == userInput:
print("Correct Spelling\n")
else:
print("Incorrect Spelling\n")
print(f"Correct: {spell_out}\n")