O   | 25. Each item in HANGMAN_PICS is a multiline string. In this game, one player plays as the girl and the other as the corgi. Lines 54 to 58 are the part of the code that does that: 54.     blanks = '_' * len(secretWord)55.56.     for i in range(len(secretWord)): # Replace blanks with correctly          guessed letters.57. As your games get more and more complex, it’s a good idea to sketch out a flowchart of what should happen in your program. Because the indexes begin at 0 and not 1, we say that Python lists are zero indexed. This game uses modern browser features which your browser doesn't support.For the best results, please get the latest version of Google Chrome. The global variable HANGMAN_PICS has a list of strings for each possible board. # This function returns True if the player wants to play again;          otherwise, it returns False.81. HANGMAN game to learn Adjectives in Spanish. The randommodule will provide this ability, so line 1 importsit. Methods are another new concept you’ll learn how to use in the Hangman game; we’ll explore them next. But ['apples'] + 'oranges' will result in an error. You have won!')108. This chapter’s game is a bit longer than the previous games, butmuch of it is the ASCII art for the hangman pictures. We play it together on the couch while watching TV. Enter list(range(10)) into the interactive shell: >>> list(range(10))[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]>>> list('Hello')['H', 'e', 'l', 'l', 'o']. Great game, I enjoyed the graphics and loved the concept. # Check if player has guessed too many times and lost.113. Line 66’s while loop will keep asking the player for a letter until they enter a single letter that hasn’t been guessed previously. Constants are variables meant to have values that never change from their first assignment statement. '.lower().upper() isn’t the same as 'Hello world! Enter the following into the interactive shell: >>> animals = ['aardvark', 'anteater', 'antelope', 'albert']>>> 'antelope' in animalsTrue>>> 'ant' in animalsFalse. Determine the game's inner physics and use … Level 3: Apprentice Miner. But because there are no more instructions after the loop, the program terminates. Line 92 calls the displayBoard() function, passing it the three variables set on lines 86, 87, and 88. The secret word is "' + secretWord +                   '"! These high-flying felines are about to begin a super important mission. It should also display how many letters the player has correctly (and incorrectly) guessed. The loop does this for every letter in the secretWord, one letter at a time. If you replace the list slices and the list indexes with the values they represent, the loop code looks like this: if 'o' in 'tr': # False    blanks = '' + 'o' + '____' # This line is skipped.--snip--if 'r' in 'tr': # True    blanks = '_tt_' + 'r' + '' # This line is executed.# blanks now has the value '_tt_r'. +---+  4. Methods are functions attached to a value. 60.     for letter in blanks: # Show the secret word with spaces in between           each letter. The next few lines of code print the new value of blanks with spaces between each letter: 60.     for letter in blanks: # Show the secret word with spaces in between          each letter.61. /    | 32. Line 43 will return the element in wordList at the integer stored in wordIndex. • The split(), lower(), upper(), startswith(), and endswith() string methods. displayBoard(missedLetters, correctLetters, secretWord) Shows the current state of the board, including how much of the secret word the player has guessed so far and the wrong letters the player has guessed. 112. But you can’t simply check whether correctLetters == secretWord. But the loop’s code on line 104 will change foundAllLetters to False the first time it finds a letter in secretWord that isn’t in correctLetters. Remember that end=' ' will replace the newline character that is printed after the string with a single space character. # Check if player has guessed too many times and lost.113. When called with one argument, range() will return a range object of integers from 0 up to (but not including) the argument. That would mean that line 43 would evaluate to return wordList[2], and then evaluate to return 'grape'. But when you enter the expression 'ant' in animals, it returns False because the string 'ant' doesn’t exist in the list. The preceding code examples all do the same thing when secretWord is 'otter' and correctLetters is 'tr'. This is like how strings begin and end in quotation marks. Come in today! playAgain() Asks if the player wants to play another round of Hangman. correctLetters = ''88. There are many dangers lurking around. getGuess(alreadyGuessed) Takes a string of letters the player has already guessed and will keep asking the player for a letter that isn’t in alreadyGuessed. spam = ['apples', 'bananas', 'carrots', 'dates'], displayBoard(missedLetters, correctLetters, secretWord). 49.     print('Missed letters:', end=' ') 50.     for letter in missedLetters: 51.         print(letter, end=' ') 52.     print() 53. This is like how strings begin and end in quotation marks. Use this link to get 80% off the Automate the Boring Stuff online video course. Try entering spam = [1, 2, 3, 4, 5, 6, 'meow', 'woof'], and then spam.reverse() to reverse the list. Extremely popular game for vocabulary and just for fun both on paper and on screen. In the Hangman game, this is how a secret word is selected for the player to guess. For a linear and closed game level like this one, detours to find buttons were quite annoying.