random word generator django

Solutions on MaxInterview for random word generator django by the best coders in the world

showing results for - "random word generator django"
Francesco
29 Mar 2020
1import random
2
3WORDS = ("python", "jumble", "easy", "difficult", "answer",  "xylophone")
4word = random.choice(WORDS)
5correct = word
6jumble = ""
7while word:
8    position = random.randrange(len(word))
9    jumble += word[position]
10    word = word[:position] + word[(position + 1):]
11print(
12"""
13      Welcome to WORD JUMBLE!!!
14
15      Unscramble the leters to make a word.
16      (press the enter key at prompt to quit)
17      """
18      )
19print("The jumble is:", jumble)
20guess = input("Your guess: ")
21while guess != correct and guess != "":
22    print("Sorry, that's not it")
23    guess = input("Your guess: ")
24if guess == correct:
25    print("That's it, you guessed it!\n")
26print("Thanks for playing")
27
28input("\n\nPress the enter key to exit")