Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started