MCPcopy Create free account
hub / github.com/asweigart/PythonStdioGames / getOneWordExcept

Function getOneWordExcept

src/gamesbyexample/hacking.py:97–105  ·  view source on GitHub ↗

Returns a random word from WORDS that isn't in blocklist.

(blocklist=None)

Source from the content-addressed store, hash-verified

95
96
97def getOneWordExcept(blocklist=None):
98 """Returns a random word from WORDS that isn't in blocklist."""
99 if blocklist == None:
100 blocklist = []
101
102 while True:
103 randomWord = random.choice(WORDS)
104 if randomWord not in blocklist:
105 return randomWord
106
107
108def numMatchingLetters(word1, word2):

Callers 1

getWordsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected