-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNumber Guessing Game.py
More file actions
34 lines (29 loc) · 971 Bytes
/
Number Guessing Game.py
File metadata and controls
34 lines (29 loc) · 971 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
32
33
34
i = "yes"
tried = 0
user = 0
import random
import time
print("")
print("Guess a correct number between 0 and 10\n")
time.sleep(0.5)
while i == "yes" or i == "y":
random_no = random.randint(0,9)
while tried<3:
user = int(input("Guess the no : "))
if user<0 or user >9:
print(str(user)+" is not in range. Try again.")
elif user != random_no:
tried = tried + 1
if tried <3:
print("Oh! Wrong Number. Try Again")
elif tried == 3:
print("You didn't guess the correct number. ["+str(random_no)+"]")
elif user == random_no:
print("You guessed the number correct. ["+str(random_no)+"]")
tried = 3
print("")
i = input("Wanna Play That Again (Yes/No) : ").casefold()
tried = 0
print("")
print("Thank for using our application.")
print("Follow me on Instagram @jatinkumar2438")