Question: This week, your lab assignment is going to be relatively short - following along with some simple programming concepts from the chapters 2 and 3.

This week, your lab assignment is going to be relatively short - following along with some simple programming concepts from the chapters 2 and 3. Below is a list of what the video will be covering. You will be turning in 1 assignment, magic8.py, through handin on the server.

  • The magic 8 ball program will first ask you if you would like to shake the magic 8 ball. You will then reply "yes" or "no". Your program should accept "yes", "Yes", "y" or "Y" as yes and anything else as no.
  • It will then ask you what question you want to ask the Magic 8 ball. (we really don't care what they type, this is just to simulate asking the Magic8 Ball a question).
  • It will then shake 3 times.... with a 1 second wait in-between (hint: use the time library and sleep(n) function).
  • It will then create a random number between 1 and 8, and pass that as an argument to your 'tellYourFortune' function. Depending on the value passed in as the argument, it will give you 1 of 8 fortunes/answers. You can make up your own or search for the responses the real Magic8 ball gives.
  • After the fortune has been told, your code will again ask if they want to shake the magic 8 ball, and continue as appropriate.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!