-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2_noGuess.py
More file actions
31 lines (22 loc) · 765 Bytes
/
Copy path2_noGuess.py
File metadata and controls
31 lines (22 loc) · 765 Bytes
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
#project:2
#Number Guessing Game
import random
print("WELCOME TO NUMBER GUESSING GAME ")
def numguess(guesser,actualno):
if guesser>actualno:
print("The number is too high,try again!")
elif guesser<actualno:
print("The number is too low,maybe next time")
else:
print("congratulation !! wanna play again")
while True:
actualno = random.randint(1,100)
print("WELCOME TO NUMBER GUESSING GAME ")
print("enter yes to play and no to exit")
ask = input("").lower()
if ask =="no":
print("Have a good day!")
break
else:
guesser = int(input("enter a number from the range 1 to 100 :"))
numguess(guesser,actualno)