From 65298add1011295c3a71cf1258098c1a2ffb9e92 Mon Sep 17 00:00:00 2001 From: thenameisadityya Date: Mon, 23 Feb 2026 10:08:09 +0530 Subject: [PATCH] Add Magic 8 Ball game script --- magic-8-ball-game/magic8ball.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 magic-8-ball-game/magic8ball.py diff --git a/magic-8-ball-game/magic8ball.py b/magic-8-ball-game/magic8ball.py new file mode 100644 index 0000000..e26ea8a --- /dev/null +++ b/magic-8-ball-game/magic8ball.py @@ -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() \ No newline at end of file