![]() While input("Do you want to play? (yes or no)") = "yes":Īlso, I took this chance to add an if main guard. S = input(prompt '(Your choices are : ' ', '.join(values) ')') You can define a function to handle getting the yes value from the user, one to handle a game, one to handle the interface (asking yes/no between games) : def get_input_in_list(prompt, values): ![]() Play = input("Do you want to play again? (yes or no)") In this fun free online game you will have to be creative and fast as you have only 30 seconds to make as many words as you can. You have the same last line in both branches of : if guess = word: Word Jumble is an entertaining puzzle game in which you have to form words to be victorious. Thus, if condition guess = word in the if branch is not true, we always go in the guess = "" part. In order for this condition not to be true, we must have : guess = word or guess = "". If you create a word that is correct but not hidden on the board, the Bonus Bar will be filled anyway. Filling the bar completely will reveal one letter on the board. As you create words, you will fill up the Bonus Bar. You have : while guess != word and guess != "":Īfter the loop, we know that condition guess != word and guess != "" is not true anymore (because we would have stayed in the loop otherwise). Using your available letters, reveal all words on the board before time runs out. Print("The jumble is:", get_jumble_word(word)) Now, the whole code is much simpler (also, you don't need word AND correct) : def get_jumble_word(word): The logic to create a jumble version looks like it could and should be put in a function on its own.Īlso we can reuse already existing functions : shuffle. ("answer", "You cant find it? the _ is _"), At the moment, I've decided to store this in a list of tuple (a dictionnary would also have done the trick). It would be much clearer to store the hint are the words together in a structure. Here you are comparing strings to get the relevant hint for an answer. Sometimes, you have to write a lot of code because "Hey, I have a lot of logic to write, I have to write code, that's the point of programming" but the point is more to keep things simple and to use the right tool (which is not always code) for the right thing. You do not respect PEP 8 and you should try to split your code into smaller chunks. Some comments from this question still apply here. Input("\n\nPress the enter key to exit.") Play=input("Do you want to play again? (yes or no)") Print("Thanks for takeing the hint, idiot.") # create a variable to use later to see if the guess is correct That creates a lot of interest in every player and they love. Different scramble words make it very difficult every day to solve. My never-ending love for this game is because it comes with new jumble puzzles. Most people love to unjumble these scramble word puzzles every day. # pick one word randomly from the sequence This is the most beautiful and loved word game called daily jumble. Play=input("Do you want to play? (yes or no)") (Press the enter key at the prompt to quit.) WORDS = ("python", "jumble", "easy", "difficult", "answer", "xylophone") # create a sequence of words to choose from # The player has to guess the original word # The computer picks a random word and then "jumbles" it I want to know if there is anything simple I can do to shrink it and add a little spice to the code. This game that I semi coded is a little bulky and kind of boring.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |