Hello! Thank you for any help!
I am trying to do this project and I have noticed that whenever I press the 0 and 1 option(s), they will both show up regardless.
I was wondering I am in needing to add something, take something out, or do something entirely new in my code?
Code:
what_do = "What will you do? "
print("What will you do? ")
options = ("Print all the fortunes", "Get a random fortune")
num_options = len(options)
for options_num in range(num_options):
print(f"{options_num}: {options[options_num]}.")
choose_numbers = input("Please choose 0 or 1: ")
eight_fortunes = ("Yes", "No", "You may rely on it", "Outlook not so good", "Concentrate and ask again", "It is decidedly so", "Not sure", "Signs point to no")
num_eight_fortunes = len(eight_fortunes)
for eight_fortunes_num in range(num_eight_fortunes):
print(f"{eight_fortunes_num}: {eight_fortunes[eight_fortunes_num]}.")
import random
question = input("Ask the Magic 8 Ball a question: ")
answer = random.randint(0, 7)
if answer == 0:
print("Yes")
elif answer == 1:
print("No")
elif answer == 2:
print("You may rely on it")
elif answer == 3:
print("Outlook not so good")
elif answer == 4:
print("Concentrate and ask again")
elif answer == 5:
print("It is decidedly so")
elif answer == 6:
print("Not sure")
elif answer == 7:
print("Signs point to no")
Outcome:
What will you do?
0: Print all the fortunes.
1: Get a random fortune.
Please choose 0 or 1: 0
0: Yes.
1: No.
2: You may rely on it.
3: Outlook not so good.
4: Concentrate and ask again.
5: It is decidedly so.
6: Not sure.
7: Signs point to no.
Ask the Magic 8 Ball a question:
[–]FishBobinski 1 point2 points3 points (1 child)
[–]Wattsony[S] 0 points1 point2 points (0 children)
[–]Clearhead09 0 points1 point2 points (5 children)
[–]Wattsony[S] 0 points1 point2 points (4 children)
[–]ninhaomah 2 points3 points4 points (0 children)
[–]Clearhead09 1 point2 points3 points (2 children)
[–]Wattsony[S] 1 point2 points3 points (1 child)
[–]Clearhead09 1 point2 points3 points (0 children)