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 diff --git a/lab2.py b/lab2.py new file mode 100644 index 0000000..5f2e1e0 --- /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}")