Skip to content
Open
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
29 changes: 29 additions & 0 deletions magic-8-ball-game/magic8ball.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import random

responses = [
"Yes, definitely!",
"No, not at all.",
"Ask again later.",
"It is certain.",
"Very doubtful.",
"Without a doubt.",
"Better not tell you now."
]

def magic_8_ball():
"""Simple CLI Magic 8 Ball game."""

print("🎱 Welcome to Magic 8 Ball 🎱")

while True:
question = input("\nAsk a question (or type 'quit'): ")

if question.lower() == "quit":
print("Goodbye 👋")
break

print("Thinking...")
print(random.choice(responses))

if __name__ == "__main__":
magic_8_ball()