#Word Jumble Game
import random
import string
def jumbled():
words = ['Jumble', 'Star']#, 'Candy', 'Wings', 'Power', 'String', 'Shopping', 'Blonde', 'Steak', 'Speakers', 'Case', 'Stubborn', 'Cat', 'Marker', 'Elevator', 'Taxi', 'Eight', 'Tomato', 'Penguin', 'Custard']
count = 0
loop = True
loop2 = True
while loop:
word = string.lower(random.choice(words)
jumble = list(word)
random.shuffle(jumble)
scrambled = "".join(jumble)
while loop2:
print '\n',scrambled,'\n'
guess = raw_input('Guess the word: ')
quit = set(['quit','Quit'])
choice = 'quit'
if guess.lower() == word:
print '\nCorrect!'
count+=1
print "You took",count,"trie(s) in order to get the right answer",jumbled()
else:
print '\nTry again!\n'
count+=1
if count == 3:
if words[0]*2:
print "It looks like you're having trouble!"
print 'Your hint is: %s'(words) # I'm trying to pull a word from the above list here.
jumbled()
Hi there! How do I go about quitting the game whenever I type in 'quit' or 'Quit'?
Basically I've created a program that gives you a mixed, jumbled up word, then I'll have to guess it correctly. When I get the ability to type, I'd like to type quit so I can exit the game whenever necessary.
Thanks in advance! (You don't need to know how the game works, I just need to find a way to type in quit then the game will quit)
Also, where would I type in the code to make it quit? Please explain this also if you're just giving me the code.