-
Notifications
You must be signed in to change notification settings - Fork 32
/
project-04.py
51 lines (37 loc) · 1.09 KB
/
project-04.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
import random
moviename = ['lagaan','highway','thor','dangal','newton']
#function will choose one random word from the given list
moviename = random.choice(moviename)
print("Guess the movie")
guesses = ''
#initial score of the user
score = 10
while score > 0:
#counts the number of times the letter does not match
c=0
for char in moviename:
if char in guesses:
print(char,end="")
else:
print('*',end="")
c+=1
if c >=1:
print("")
print("Your Score:",score)
if c ==0:
print("")
print("Your Score:",score)
print("YOU WIN!!")
break
#user has to input new alphabet if the previous alphabet did not match
guess=input("Guess a letter:")
#new input will be stored in guesses
guesses += guess
if guess not in moviename:
score-=2
print("Wrong guess!Try again.")
if(score <= 0):
print("YOU LOOSE!")
else:
print("Correct Guess")
score+=3