-
Notifications
You must be signed in to change notification settings - Fork 0
/
guess wordd.py
63 lines (31 loc) · 1.28 KB
/
guess wordd.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
import random as rdm
# Here the user will be asked to enter their name first
name1 = input("What is your NAME ? ")
print("Best of Luck! ", name1)
words1 = ['Donkey', 'Aeroplane', 'America', 'Program',
'Python', 'language', 'Cricket', 'Football',
'Hockey', 'Spaceship', 'bus', 'flight']
word1 = rdm.choice(words1)
print ("Please guess the characters: ")
guesses1 = ''
turns1 = 10
while turns1 > 0:
failed1 = 0
for char in word1:
if char in guesses1:
print(char)
else:
print("_")
failed1 += 1
if failed1 == 0:
print("User Win")
print("The correct word is: ", word1)
break
guess1 = input("Guess another character:")
guesses1 += guess1
if guess1 not in word1:
turns1 -= 1
print("Wrong Guess")
print("You have ", + turns1, 'more guesses ')
if turns1 == 0:
print("User Loose")