-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpredictor_app
More file actions
46 lines (38 loc) · 1.12 KB
/
predictor_app
File metadata and controls
46 lines (38 loc) · 1.12 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
import random
from time import sleep
from colorama import Fore, Style, init
# Initialize colorama with auto-reset
init(autoreset=True)
red = Fore.RED
green = Fore.GREEN
def predict():
total_iterations = random.randint(1, 44)
for i in range(1, total_iterations + 1):
result = random.choice(
[
"Yes",
"No",
"Maybe",
"Not the right time to ask",
"100% yes",
"Definitely not!",
"Resounding yes",
"Totally impossible",
]
)
if i == total_iterations:
print(f"The universe says: {green}{result}")
else:
print(red + "thinking...")
sleep(random.randint(0, 1))
# Ask the user if they want to ask another question
ask_again = input("Would you like to ask another question? (y/n): ")
if ask_again == "y":
predict()
else:
print("Thank you for playing!")
exit()
# Get user input for a yes or no question
question = input("Please ask a question: ")
# Call the predict function
predict()