Skip to content

Create InspireQuotes.py #206

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions 8_Ball_game/8_ball.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import random

# Randomly generated responses for the 8 Ball.
def magic_8_ball():
responses = [
"It is certain.",
"It is decidedly so.",
"Without a doubt.",
"Yes definitely.",
"You may rely on it.",
"As I see it, yes.",
"Most likely.",
"Outlook is good.",
"Yes.",
"Signs point to yes.",
"Reply hazy, try again.",
"Ask again later.",
"Better not tell you now.",
"Cannot predict now.",
"Concentrate and ask again.",
"Don't count on it.",
"My reply is no.",
"My sources say no.",
"Outlook is not so good.",
"Very doubtful."
]

# Prompt user to input question for 8 Ball response.
while True:
question = input("Ask the Magic 8 Ball a question (type 'exit' to quit): ")
if question.lower() == 'exit':
break
answer = random.choice(responses)
print("Magic 8 Ball says:", answer)

magic_8_ball()
28 changes: 28 additions & 0 deletions InspireQuotes/InspireQuotes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# A game that sends you an inspirational quote when you choose a number.

def inspirational_quote(number):
quotes = {
1: "Believe you can and you're halfway there. -Theodore Roosevelt",
2: "The future belongs to those who believe in the beauty of their dreams. -Eleanor Roosevelt.",
3: "The only way to do great work is to love what you do. -Steve Jobs.",
4: "Everything youve ever wanted is on the other side of fear. -George Addair.",
5: "Success is not final, failure is not fatal: It is the courage to continue that counts. –Winston Churchill.",
6: "The strongest principle of growth lies in the human choice. -George Eliot.",
7: "Be yourself; everyone else is already taken. -Oscar Wilde.",
8: "Be the change that you wish to see in the world. -Mahatma Gandh.",
9: "If people are doubting how far you can go, go so far that you cant hear them anymore. -Michele Ruiz"
}
return quotes.get(number)

def main():
print("Choose a number between 1-9 to receive an inpiring quote. ")
try:
number = int(input())
quote = inspirational_quote(number)
print(quote)
except ValueError:
print("Please enter a valid number.")

if __name__ == "__main__":
main()