Project #1 - Python Magic 8 Ball: Complete Python Programming Masterclass Beginner To Advanced

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Complete Python Programming Masterclass Beginner to Advanced

Project #1 – Python Magic 8 Ball


This project will present you with the opportunity to apply the skills that you have learned up to this
point with the course.

1.1BUILD A MAGIC 8 BALL APP IN PYTHON


This project will require you to create a single Python file (.py). You will find a file called,
“PythonMagicBall-08-01.py” attached to this lecture. You can use this file as a starting point for the
project.

The project will prompt the user to type a question. The code will then randomize a response and return
(print) the response back to the user, based on 8 pre-defined response.

Step 1

• Two modules will need to be imported into your Python file.


o “sys” module and the “random” module
o You can read more on the “sys” module here:
https://docs.python.org/2/library/sys.html
o You can read more on the “random” module here:
https://docs.python.org/2/library/random.html
• Research the two modules by using the “dir” function. Ex. dir(math)
o Identify any of the attributes/functions that will help you in completing this project

Requirements

• When a user runs the project, they should receive a prompt (printed message), asking them to
ask the magic 8 ball a question.
• The user will then type in a question and press the enter key.
• Logic, built in the code, will then return a random response back to the user.
o Valid random response will include:
▪ “IT IS CERTAIN”
▪ “YOU MAY RELY ON IT”
▪ “AS I SEE IT, YES”
▪ “OUTLOOK LOOKS GOOD”
▪ “MOST LIKELY”
▪ IT IS DECIDELY SO”
▪ “WITHOUT A DOUBT”
▪ “YES, DEFINETLY”
o You can decide how to store the valid responses and how to randomly return on of the
responses.
• The program should continue to run in a loop, returning a random response for each question
they user types.
• If the user doesn’t enter a question and the presses the enter key, then the application should
quit.
************************** CODE SPOILER ************************

***************************************************************

***************************************************************

***************************************************************

***************************************************************

COMPLETED CODE IS FOUND ON THE NEXT PAGE

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy