# Magic 8-ball projects

#imported numbers for magic 8-ball
import random
random_number = random.randint(1,12)

name = “Ariel”
question = “Will I get chocolate today?”

#random number generated by system

print(random_number)

#conditionals that tell program what to say based on generated number

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 = " The shun is shinning on you today!"
elif random_number == 11:
elif random_number == 12:
else:

if name == “”:
print(name + " asks: " + question)
else:
print(name + " asks: " + question)

if question == “”:
else:

This is one of the first projects I have successful made and I wanted to share it with you guys. If you have any pointers on improving it I welcome it.

Hello!

Well done on completing the project! In future please use this guide on how to format code when sharing it as it just makes things a little clearer, especially for languages such as Python that are so indentation sensitive.

One little bit of feedback I would have on the project itself if you don’t mind is this conditional:

``````if name == "":
print(name + " asks: " + question)
else:
print(name + " asks: " + question)
``````

Since the same thing is executed regardless of the conditional, there isn’t strictly a need to have the conditional at all, and you could just have a single `print` statement instead of the whole if/else block.

Happy coding!