dimanche 4 novembre 2018

wordList - Hangman game

So I was creating this hangman game with a book (Invent your own computer games in python). It shows me this words with these set of animals. But what I don't understand is how come the wordList is related to words:

words = 'ant babboon badger bat bear beaver camel cat clam cobra cougar coyote crow deer dog donkey duck eagle ferret fox frog goat goose hawk lion lizard llama mole rat raven rhino shark sheep spider toad turkey turtle wolf wombat zebra'

def getRandomWord(wordList):
    # This function returns a random string from the passed list of strings.
    wordIndex = random.randint(0, len(wordList) - 1 )
    return wordList[wordIndex]




Aucun commentaire:

Enregistrer un commentaire