-
Notifications
You must be signed in to change notification settings - Fork 0
/
Control Flow 1.py
42 lines (38 loc) · 1.18 KB
/
Control Flow 1.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
39
40
41
42
import random as rd
#Our Variables for our code
name = "Eric"
question = "Will I secure a job to stay out in Ventura County for the next year at least?"
Answer = ""
#Setting the random number, which determines our responses
random_number = rd.randint(1,9)
#print(random_number)
#Assigning strings to variable depending on value
if random_number == 1:
answer = "Yes - definitley."
elif random_number == 2:
answer = "It is decidedly so."
elif random_number == 3:
answer = "Without a doubt."
elif random_number == 4:
answer= "Reply hazy, try again."
elif random_number == 5:
answer= "Ask again later."
elif random_number == 6:
answer = "Better not tell you now."
elif random_number == 7:
answer = "My sources say no."
elif random_number == 8:
answer = "Outlook not so good."
elif random_number == 9:
answer = "Very doubtful."
else:
answer = "Error"
#Control Flow
if name == "":
print("Question: " + question)
print("Magic 8-Ball's answer: " + answer)
elif question == "":
print("You must ask a question, I cannot read minds without the purchase of 8-Ball premium. Click here to upgrade now!")
else:
print(name + " asks: " + question)
print("Magic 8-Ball's answer: " + answer)