![]() Partially guessed word so far, as well as letters that theįollows the other limitations detailed in the problem write-up. * After each round, you should also display to the user the * The user should receive feedback immediately after each guessĪbout whether their guess appears in the computers word. * At the start of the game, let the user know how many Starts up an interactive game of Hangman. SecretWord: string, the secret word to guess. Print( "Available letters: " + getAvailableLetters( lettersGuessed)) Print( "You have " + str( guessLeft) + " guesses left.") Guess = input( "Please guess a letter: ")ĭef printEachRoundResult( guessLeft, lettersGuessed): RetList = list( "abcdefghijklmnopqrstuvwxyz") Returns: string, comprised of letters that represents what letters have not What letters in secretWord have been guessed so far.įor index, item in enumerate( secretWord):ĭef getAvailableLetters( lettersGuessed): Returns: string, comprised of letters and underscores that represents Returns: boolean, True if all the letters of secretWord are in lettersGuessed ĭef getGuessedWord( secretWord, lettersGuessed): LettersGuessed: list, what letters have been guessed so far SecretWord: string, the word the user is guessing ![]() # so that it can be accessed from anywhere in the programĭef isWordGuessed( secretWord, lettersGuessed): # Load the list of words into the variable wordlist Print( " ", len( wordlist), "words loaded.") Words are strings of lowercase letters.ĭepending on the size of the word list, this function may # but you will have to know how to use the functions # You don't need to understand this helper code,
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |