MCPcopy Create free account
hub / github.com/Mrinank-Bhowmick/python-beginner-projects / get_word

Function get_word

projects/Hangman/main.py:108–124  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

106
107
108def 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
127def choose_difficulty():

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected