Edit and test statements in Python

Can you help me check if I have any errors?

name = “Joe”
question = “Will I win the lottery?”
answer = “”

import random
random_number = random.randint(1, 9)
print(random_number)

if random_number == 1:
anwser = “Yes - definitely.”
elif random_number == 2:
awser = “It is decidedly so”
elif random_number == 3:
anwser = “Without a doubt.”
elif random_number == 4:
answer = “Reply hazy, try again”
elif random_number == 5:
anwser = “Ask again later”
elif random_number == 6:
anwer = “Better not tell you now.”
elif random_number == 7:
anwser = “My sources say no.”
elif random_number == 8:
anwser = “Outlook not so good”
elif random_number == 9:
anwser = “Very doubtful”
else:
anwser = “Error”

name = “Joe asks,”
question = “Will I win the lottery?”
print(name, question)

st = “Magic 8-Ball’s answer:”
st1 = “My sources say no”
print(st, st1)

This command I entered as the topic, but the system still gives an error

random_number = random.randint(1, 10)
elif random_number == 10:
answer = “Signs point to yes”

Hello! What error are you receiving, and can you please format your code according to this guide?

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.