Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python languge, all what I need is the code please. Thanks. Overview We are creating a magic 8 ball. Magic 8 balls are some voodoo

python languge, all what I need is the code please. Thanks.
image text in transcribed
image text in transcribed
Overview We are creating a magic 8 ball. Magic 8 balls are some voodoo magic that can detect the future (at least, I thought that as a kid!). You ask the magic 8 ball a yes or no question, shake it, and hope for the best. For this project, we are going to create a computerized magic 8 ball. There are 20 possible answers the magic 8 ball can show (see table below). First, you need to ask the user if they would like to play. Using a while loop, the user should be able to play as many times as they'd Iike (getting different responses each time). If the user type's 'no' to the play prompt, the program should end. After the user asks their question, a random answer from the 20 responses should appear. Then, after the answer is given, the user should be asked if they want to play again. Instructions/Output - Have a greeting that asks if the user wants to begin. If the user wants to begin, pursue with the code. If the user does not want to play, end the program. Save this response as a variable named startQ - Allow the user to type a question (this does not have to be saved input... simply to entertain the user). - Geherate a random answer from the list of 20 responses to whatever the user asks. - Using the same startQ variable, reask the user if they'd like to ask another question. - If the user wants to ask another question, loop through the code again (should generate a new random response). If the user does not want to play again, end the program. Example output on next page. Tips - We have learned how to generate random numbers with the randint function. One option would be to save the random integer as a variable, then create an if-then statement with that variable (if the integer is equal to 1 , then print option 1 , and so fourth). - We'll need a while loop that allows the user to keep asking questions. Take this project one step at a time and try to simply get the random responses to display first. Then, you can add the while loop after you know you are generating random answers

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases In Action

Authors: Dave Bechberger, Josh Perryman

1st Edition

1617296376, 978-1617296376

More Books

Students also viewed these Databases questions

Question

4. How has e-commerce affected business-to-business transactions?

Answered: 1 week ago