# Check the code

I was solving the Magic 8 Ball question 14. I did it a bit differently than the answer given in the hint. Can anyone just have a look on my code and give me feedback.

I apologise for the inconvenience caused. Below is the code posted as formatted text.
Here is the link to the question -

``````import random
name = ""
question = ""
random_number = random.randint(1, 15)
if random_number == 1:
elif random_number == 2:
answer += "It is decidedly so."
elif random_number == 3:
elif random_number == 4:
elif random_number == 5:
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:
elif random_number == 10:
answer += "You may rely on it."
elif random_number == 11:
answer += "As I see it, yes."
elif random_number == 12:
elif random_number == 13:
answer += "Don't count on it."
elif random_number == 14:
elif random_number == 15:
else:

if name == "" and question == "":
print("You have not asked a question.")
elif name == "":
print("Question: ", question)
else:

#if question == "":
#print("You have not asked a question.")
#else:

``````

Hi 16bme1040,

Your code looks great! If you want to take it a step further, you should consider assigning `name` and `question` as an `input()` functions like so:

``````name = input("What is your name: ")
question = input("What is your question: ")
``````

Also, on line 39, technically you only need to check if `question` is empty, and not both `name` and `question` like so:

``````if question == "":
print("You have not asked a question.")
``````

Again, great job!

Thank you again very much