![]() Here is how I would write (have written today :) the jumble of word: jumble = ''.join(random.sample(correct,len(correct))) Print('Sorry: Your guess of "%s" is not correct.'%guess) WordsHints = (("python", "A programming language."), Thanks for the help everyone! Now I understand how to grab just one element from a tuple inside a tuple. ![]() When I added woooee's code first, it still gave an output of "Sorry, that's not it." But after I added griswolf's suggestion, it was able to give the correct outputs. But its really bugging me that I did not solve this challenge. I'm also just skipping past this challenge and moving on to the next chapters. Previous chapters covered: types, variables, branching and while loops. Though I'm not really sure if that would work. The indices of the hints are equivalent to the indices in words. Raw_input("\n\nPress the enter key to exit.") While (guess != correct) and (guess != ""): (Press the enter key at the prompt to quit.) ![]() # create a variable to use later to see if the guess is correct "Antonym of easy.", "Antonym of question.", "A musical instrument.") HINTS = ("A programming language.", "Word _.", "Antonym of difficult.", WORDS = ("python", "jumble", "easy", "difficult", "answer", "xylophone") # create a sequence of words to choose from # The player has to guess the original word # The copmuter picks a random word and then "jumbles" it Add a scoring system that rewards players who solve a jumble without asking for a hint."īelow is the code for the Word Jumble Game: # Word Jumble The player should be able to see the hint if he or she is stuck. At the end of chapter 4: "for Loops, Strings and Tuples", there is a challenge that asks so "improve Word Jumble so that each word is paired with a hint. I'm working my way through Michael Dawson's Python Programming for the Absolute Beginner book.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |