-
Notifications
You must be signed in to change notification settings - Fork 0
/
practise.py
146 lines (103 loc) · 3.07 KB
/
practise.py
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
import random
import os, sys
from time import sleep
import cursor
def load_words():
lines =open('words.txt', 'r').readlines()
line = lines[0]
words =line.split()
myword = random.choice(words)
return myword
#wordlist = load_words()
#print(wordlist)
os.system('cls')
word = load_words()
#word1 = 'america'
cursor.hide()
print(''' Welcome to''')
wcText = ''' Wheel Of Fortune - Python Mini Project by
@@@ @@@ @@@ @@@@@@ @@@ @@@ @@@@@@ @@@@@@@ @@@@@@@@
@@@ @@@ @@@ @@@@@@@ @@@ @@@ @@@@@@@@ @@@@@@@@ @@@@@@@@
@@! !@@ @@! !@@ @@! @@@ @@! @@@ @@! @@@ @@!
!@! @!! !@! !@! !@! @!@ !@! @!@ !@! @!@ !@!
@!@@!@! !!@ !!@@!! @!@!@!@! @!@ !@! @!@!!@! @!!!:!
!!@!!! !!! !!@!!! !!!@!!!! !@! !!! !!@!@! !!!!!:
!!: :!! !!: !:! !!: !!! !!: !!! !!: :!! !!:
:!: !:! :!: !:! :!: !:! :!: !:! :!: !:! :!:
:: ::: :: :::: :: :: ::: ::::: :: :: ::: :: ::::
: ::: : :: : : : : : : : : : : : : :: ::'''
for ch in wcText:
sys.stdout.write(ch)
sys.stdout.flush()
sleep(4)
os.system('cls')
cursor.show()
def Guess(Choice):
if Choice == 'y':
ChoosingWord()
elif Choice == 'n':
choosingLetter()
os.system('cls')
else:
print("Unsupported input")
print("Exiting...")
sleep(2)
exit()
os.system('cls')
def ChoosingWord():
playin = input("Enter word \n>").upper()
if playin == word:
#print("The Word is ",playin)
print(playin," is the correct answer")
exittext = input('Want to exit (y/n)? \n>')
ExitOrTryAgain(exittext)
os.system('cls')
else:
#print(new_state)
print(playin,"is the wrong answer :(")
print("Do you Want to Try again ")
print("Enter 'y' to continue or 'a' to Reveal the Answer and Exit ")
et = input("Your Choice is? \n>")
if et == 'a':
print("The correct answer is ", word)
print("Exiting...")
sleep(4)
exit()
elif et == 'y':
pass
else:
exit()
os.system('cls')
def choosingLetter():
global new_state
chosen_word = word.upper()
state = "_"*len(chosen_word)
guess = input("Guess the letter: \n>").upper()
new_state = [(chosen if chosen == guess else blank)
for chosen, blank in zip(chosen_word, state) ]
' '.join(new_state)
print(new_state)
sleep(3)
return new_state
os.system('cls')
def ExitOrTryAgain(option):
if option == 'y':
exit()
elif option == 'n':
pass
else:
print("Unsupported input")
exit()
print("Exiting...")
sleep(2)
os.system('cls')
while True:
blank = len(word)* '_ '
print("Guess the word :) ",blank)
print("Enter 'y' to guess the word")
print("Enter 'n' to guess the letter")
Choice = input("Enter your Choice (y/n): \n>")
os.system('cls')
Guess(Choice)
sleep(1)
os.system('cls')