-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNoPrediction.py
More file actions
65 lines (48 loc) · 1.22 KB
/
NoPrediction.py
File metadata and controls
65 lines (48 loc) · 1.22 KB
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
64
65
import random
import time
import sys
def loading(text):
for i in range(3):
sys.stdout.write(text + "." * (i + 1) + "\r")
sys.stdout.flush()
time.sleep(0.2)
print(" " * 30)
def success_animation():
print("Checking answer", end="")
for i in range(5):
print(".", end="", flush=True)
time.sleep(0.1)
print("\n")
print("🎉🥳🥳 Correct!!! 🎉🥳🥳")
for i in range(3):
print("★ " * (i))
time.sleep(0.1)
# print("You win!\n")
def wrong_animation():
print("Checking", end="")
for i in range(3):
print(".", end="", flush=True)
time.sleep(0.2)
print()
print("=== Number Guessing Game ===")
loading("Starting game")
secret = random.randint(1, 30)
attempts = 0
while True:
guess = int(input("Enter number (1-30): "))
attempts += 1
wrong_animation()
if guess < secret:
print("Too small!\n")
elif guess > secret:
print("Too big!\n")
else:
success_animation()
print("Attempts:", attempts)
break
if attempts <3:
print ('🔥🔥your are Legend 🔥🔥')
elif 3<=attempts<=5:
print ('your are Hero 😎😎')
else:
print (' your are Noob🤣🤣 ')