From 2d2dccbcaa5f273b040cfef1990718270d8467c9 Mon Sep 17 00:00:00 2001 From: Joel804 Date: Sat, 18 Jan 2025 14:13:48 -0500 Subject: [PATCH 1/3] Updating guidelines with Python Zen --- CONTRIBUTING.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 68f7428..d459ca1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -12,3 +12,5 @@ Please ensure your pull request adheres to the following guidelines: - Check your spelling and grammar. Thank you for your suggestions! + + Beautiful is better than ugly. / Simple is better than complex. \ No newline at end of file From 19012347634c6ebaa3a621af419c05ebda648a24 Mon Sep 17 00:00:00 2001 From: Joel804 Date: Sat, 18 Jan 2025 14:25:48 -0500 Subject: [PATCH 2/3] Adding lab 2 --- lab2.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 lab2.py diff --git a/lab2.py b/lab2.py new file mode 100644 index 0000000..ae69ccb --- /dev/null +++ b/lab2.py @@ -0,0 +1,26 @@ +import random + +weapons = ["Fist", "Knife", "Club", "Gun", "Bomb", "Nuclear bomb"] +print("Weapons: ", weapons) + +try: + weaponRoll = random.randint(1, 6) + print(f"Weapon roll: {weaponRoll}") + + hero_weapon = weapons[weaponRoll - 1] + print(f"Your hero's weapon: {hero_weapon}") + + if weaponRoll <= 2: + print("You rolled a weak weapon, friend.") + elif weaponRoll <= 4: + print("Your weapon is meh.") + else: + print("Nice weapon, friend!") + + if hero_weapon != "Fist": + print("Thank goodness you didn't roll the Fist...") + +except IndexError as e: + print(f"Error: {e}") +except Exception as e: + print(f"An unexpected error occurred: {e}") From 7e9d01f9d7a4d61ef6ba896cf68e18e1b227b83c Mon Sep 17 00:00:00 2001 From: Joel804 Date: Sat, 18 Jan 2025 14:33:44 -0500 Subject: [PATCH 3/3] Adding lab2 to repository --- lab2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lab2.py b/lab2.py index ae69ccb..5f2e1e0 100644 --- a/lab2.py +++ b/lab2.py @@ -18,7 +18,7 @@ print("Nice weapon, friend!") if hero_weapon != "Fist": - print("Thank goodness you didn't roll the Fist...") + print("Thank goodness you didn't roll the Fist..") except IndexError as e: print(f"Error: {e}")