Please Help (Magic 8 Ball)

*Need Help With Magic 8 Ball!! Says that there is a syntax error when I can not see one. It says issue is in line 20

import random

random_number = random.randint(1, 9)

print(random_number)

name = “John”

question = “Do you like coding?”

answer = “”

if random_number == 1:

answer = " Yes - definitely."

elif random_number == 2:

answer = "It is decidedly so."

elif random_number == 3:

asnwer = "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."

else random_number:

answer = "Very doubtful."

print([name] + “asks:” + [question])

print("Magic 8-Ball’s Answer: " + answer)

Do these two lines appear to have the correct syntax?:

answer("Better not tell you now."

And:

answer"My sources say no."

What are you trying to do with the values and the answer variable?

Sorry this happened when i was copy and pasting the code. I fixed it anyway thank you though.

1 Like