-
Notifications
You must be signed in to change notification settings - Fork 0
/
Guess Game with Import Module.py
38 lines (38 loc) · 1.35 KB
/
Guess Game with Import Module.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
import random
print("In This game you have to guess the number Between 1 to 20.You have 6 Lives Lest")
while True:
x = input("You Wanna Play this Game.Type Y for yes and N to quit: ")
a = random.randint(1,20)
t = 7
i = 20
if x=="Y":
while True:
t = t-1
if t==0:
print("You are out of lives.\nYOU LOOSE!!!")
print("Number to be Guessed is ",a)
break
else:
n = int(input("Guess the number: "))
print("Total Lives Left are ",t)
if n==a:
print("You Won!,your Guess is correct,")
i = i+1
print("Your Score is: ",i)
break
elif n<a:
print("Your Guess is Low ,Try Higher Number")
i = i-1
print("Your Score is: ",i)
continue
elif n>a:
print("Your Guess is High,Try Lower Number")
i = i-1
print("Your Score is: ",i)
continue
elif x=="N":
print("Thank You!.For Playing the game .Hope! you like it.")
break
else:
print("You write the Typed the wrong Number or letter,Try again")
continue