From cc665a95fcb7b775ab316ed83f7c3f0ec5d38634 Mon Sep 17 00:00:00 2001 From: Levi Entz Date: Tue, 12 Aug 2025 15:13:15 +0000 Subject: [PATCH 1/4] fixed magic8 by importing random --- magic8.py | 1 + 1 file changed, 1 insertion(+) diff --git a/magic8.py b/magic8.py index c02c7c2..cadcd19 100644 --- a/magic8.py +++ b/magic8.py @@ -1,3 +1,4 @@ +import random name = "Joe" question = "Will I win the lottery?" answer = "" From fc9a0394416f1626a6ec0b791574a0c75d279c5a Mon Sep 17 00:00:00 2001 From: Levi Entz Date: Tue, 12 Aug 2025 15:15:06 +0000 Subject: [PATCH 2/4] added random import --- .vscode/settings.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..65d939f --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,11 @@ +{ + "python.testing.unittestArgs": [ + "-v", + "-s", + ".", + "-p", + "*test.py" + ], + "python.testing.pytestEnabled": false, + "python.testing.unittestEnabled": true +} \ No newline at end of file From 50a50f877672705d37d135c8a83ec702b4839f3e Mon Sep 17 00:00:00 2001 From: Levi Entz Date: Thu, 14 Aug 2025 17:53:53 +0000 Subject: [PATCH 3/4] changes --- magic8.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/magic8.py b/magic8.py index cadcd19..8b6e083 100644 --- a/magic8.py +++ b/magic8.py @@ -1,6 +1,6 @@ import random name = "Joe" -question = "Will I win the lottery?" +question = "WIll the Chiefs win the supperbowl" answer = "" random_number = random.randint(1, 9) From c5119fbbe250c4133caab28c5a8c628a6a91ec95 Mon Sep 17 00:00:00 2001 From: Levi Entz Date: Tue, 19 Aug 2025 21:28:55 +0000 Subject: [PATCH 4/4] added strings and questions to make it more user friendly --- magic8.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/magic8.py b/magic8.py index 8b6e083..68dadbf 100644 --- a/magic8.py +++ b/magic8.py @@ -1,9 +1,9 @@ import random name = "Joe" -question = "WIll the Chiefs win the supperbowl" +question = "Will the Chiefs win the supperbowl" answer = "" -random_number = random.randint(1, 9) +random_number = random.randint(1, 11) # print(random_number) if random_number == 1: @@ -24,8 +24,20 @@ answer = "Outlook not so good" elif random_number == 9: answer = "Very doubtful" +elif random_number == 10: + answer = "Absolutely not" +elif random_number == 11: + answer = "no!" else: answer = "Error" - -print(name + " asks: " + question) -print("Magic 8 Ball's answer: " + answer) + +print(f"{name} asks: {question}") +print("Magic 8-Balls answer:" + answer) + +if question == "": + print("You must ask a question!") +elif name.strip() == "": + print("Question:") +else: + answer = name +