-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJumbleGame.py
More file actions
89 lines (67 loc) · 2.4 KB
/
Copy pathJumbleGame.py
File metadata and controls
89 lines (67 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#Javon Payne
#06OCT2020
#JumbleGame
import random
WORDS = ("cat", "dog", "duck", "feed", "texture", "conservation", "circle", "quota", "chemistry", "provoke", "relevance")
HINTS = ("Meows.",
"Barks.",
"Quacks.",
"A verb.",
"Can feel it.",
"To save or keep.",
"A shape.",
"Police need it.",
"Science class.",
"To start something or encourage.",
"Of matter or apart of the subject."
)
choice = 'y'
overallScore = 0
while choice.lower() == 'y':
score = 10
wordIndex = random.randrange(len(WORDS))
word = WORDS[wordIndex]
hint = HINTS[wordIndex]
jumble = ""
correct = word
#wrong = Sorry, thats not it.
while word:
position = random.randrange(len(word))
jumble += word[position]
word = word[:position] + word[(position + 1):]
print("""
__ __ __ __ __ ______ __ ______
/\ \ /\ \/\ \ /\ "-./ \ /\ == \ /\ \ /\ ___\
_\_\ \ \ \ \_\ \ \ \ \-./\ \ \ \ __< \ \ \____ \ \ __\
/\_____\ \ \_____\ \ \_\ \ \_\ \ \_____\ \ \_____\ \ \_____\
\/_____/ \/_____/ \/_/ \/_/ \/_____/ \/_____/ \/_____/
""")
print("\n\t\t\tWelcome to the Word Jumble!")
print("\t\tUnscramble the letters to make a word")
print("\t\t\t(Type 'hint' for a hint)")
print("\nThe jumble is:", jumble)
guess = input("\nGuess the word: ")
if guess.lower() == "hint":
print(hint)
score -= 4
elif guess == correct:
print("correct")
elif guess != correct:
print("Sorry, thats not it.")
while guess.lower() != correct.lower():
guess = input("Guess the word: ")
score -= 1
if guess == correct:
print("Correct")
if guess.lower() == "hint":
print(hint)
score -= 4
elif guess != correct:
print("Sorry, thats not it.")
print("You guessed it!")
overallScore += score
print("Score:", score)
print("Overall:", overallScore)
choice = input("\nWould you like to jumble another word? (Y/N) ")
else:
print("")