I reorganized the code into functions to make it more readable. It's good practice to keep each function limited to its purpose instead of trying to do everything in one function. In the interest of keeping the function simple, ideally you'd want this other loop to be wherever you called word_list rather than in word_list itself. The second part of your question means that you want another loop. So what you want to do is to have the first input outside of the loop, and only put the retries inside. What you are repeating is the part where you tell the user that they got it wrong and to input it again. In this example, you don't want to put the main input in the loop, because that's not what you're repeat. You don't need to have everything in them, only the stuff you want to repeat. You might now look for a way to simplify this but this should get you going again. I think a very light change to your code might allow you to do this: import random #Import random function One to get a word then an inner loop to get responses from the user until they get it right. You seem to need a solution that uses nested loops. Print('You spelled that word wrong, please try again!')Īnswer = input('Retype the word and press enter:') Print('Great job you spelled it correctly!') If answer = question: #If statement that confirms the user spelled the word right Print(question) #Displays the word that was generatedĪnswer = input('Retype the word and press enter:') #User retypes the Question = random.choice(list(words)) #Generates a random word from the list So make the most out of it, and share it with others who may benefit from this.Source code for a random word generator that has the user type the word to confirm def word_list(): This tool is completely free, easy, and can be used unlimited times. Taking inspiration with random words and then using some of your creativity, you can come up with a perfect name. This tool can help you in finding a good name for your product, business, event, or your team. Rather than asking your friends to give you words, to play it fare use this tool. In this game, a performer has to draw a picture of the word they have received and the team has to guess that word to earn points. Have you ever heard of Pictionary? It’s a game which you can play with your friends and family in teams. You can tweak this task to make it easier or more difficult. This will help you in being more ideas and who knows, it may lead you to a new storyline or a topic on an article. Do note, the paragraph has to include all the words. Now use those words and write a paragraph. Simply generate any number of words with a particular word type. Then you can simply copy those words and learn about them.Īre you a creative being and want to challenge yourself in writing? We have a fun and interesting task for you. Chances are you may find some words you have not heard before. You can simply choose your desired setting by choosing the suffix and prefix and the word type such as adjectives. This tool can help you improve your vocabulary. This tool can be used in improving the language, playing games with friends and family, and many more. There are many uses online tools such as random text generators. To clear the selection select the button named “Clear words”. You can click on the “Copy words” button to copy the words in your clipboard. This will then temporarily store your selected words in the “Your words” section. Choose the words you like and want to copy by simply making a click on the words. This will only give you a random list of words only with those parameters. You can enter your desired starting letter and/ or ending letter in these options. Start with and End with: Let’s say you want a word with a certain suffix or prefix.If you want to rather go further narrow down, you can go with random verbs, nouns, adjectives, prepositions, or compound words. This will give you a list of random words without any type of words. If you don’t have any preference, go with the first option “Words (all)”. Word Type: In this setting, the tool offers you different options of words you want to generate.Here in this box, you have to enter the number of how many words you want to generate. You can enter the number you want to create random lists of words. Number of words: The first option you can see above is a text box.The settings to generate a random list of words are as follows: You have an option to choose any settings above.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |