easy_wordlist (list): list of words (strings) - for easy difficulty level medium_wordlist (list): list of words (strings) - for medium difficulty level hard_wordlist (list): list of words (strings) - for hard difficulty level Returns a word from wordlist at random
()
| 106 | |
| 107 | |
| 108 | def get_word(): |
| 109 | """ |
| 110 | easy_wordlist (list): list of words (strings) - for easy difficulty level |
| 111 | medium_wordlist (list): list of words (strings) - for medium difficulty level |
| 112 | hard_wordlist (list): list of words (strings) - for hard difficulty level |
| 113 | |
| 114 | Returns a word from wordlist at random |
| 115 | """ |
| 116 | if DIFFICULTY_LEVEL == "easy": |
| 117 | word = random.choice(easy_wordlist) |
| 118 | elif DIFFICULTY_LEVEL == "medium": |
| 119 | word = random.choice(medium_wordlist) |
| 120 | elif DIFFICULTY_LEVEL == "hard": |
| 121 | word = random.choice(hard_wordlist) |
| 122 | else: |
| 123 | word = random.choice(medium_wordlist) |
| 124 | return word.upper() |
| 125 | |
| 126 | |
| 127 | def choose_difficulty(): |