commit 3b0d8c9357f8e4e12deccdb314268f0dd6f9e965 Author: EntropicDecay Date: Mon Apr 29 17:46:36 2024 -0500 initial commit diff --git a/.gitea/workflows/lint.yaml b/.gitea/workflows/lint.yaml new file mode 100644 index 0000000..5fa4f0a --- /dev/null +++ b/.gitea/workflows/lint.yaml @@ -0,0 +1,20 @@ +name: Actions +on: + push: + branches: + - 'main' + +jobs: + Lint Code (Ruff & Pylint): + runs-on: docker + container: www.coastalcommits.com/seaswimmerthefsh/actionscontainers-seacogs:latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Analysing code with Ruff + run: ./.venv/bin/ruff check $(git ls-files '*.py') + continue-on-error: true + + - name: Analysing code with Pylint + run: ./.venv/bin/pylint --rcfile=.forgejo/workflows/config/.pylintrc $(git ls-files '*.py') \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ed8ebf5 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +__pycache__ \ No newline at end of file diff --git a/Blastoff!/README.md b/Blastoff!/README.md new file mode 100644 index 0000000..6b7ebb0 --- /dev/null +++ b/Blastoff!/README.md @@ -0,0 +1 @@ +# Blastoff! \ No newline at end of file diff --git a/Blastoff!/__init__.py b/Blastoff!/__init__.py new file mode 100644 index 0000000..05fd078 --- /dev/null +++ b/Blastoff!/__init__.py @@ -0,0 +1 @@ +35,32,100,111,110,39,116,32,109,111,100,105,102,121,32,116,104,105,115,32,102,105,108,101 \ No newline at end of file diff --git a/Blastoff!/blastoff.py b/Blastoff!/blastoff.py new file mode 100644 index 0000000..70a42ba --- /dev/null +++ b/Blastoff!/blastoff.py @@ -0,0 +1,27 @@ +from time import sleep + +def countdown(n: int) -> None: + if n <= 0: + print('Blastoff!') + else: + print(n) + sleep(1) + countdown(n-1) + +def countup(n: int) -> None: + if n >= 0: + print('Blastoff!') + else: + print(n) + sleep(1) + countup(n+1) + +def count(n: int) -> None: + if int(n) >= 0: + countdown(n) + else: + countup(n) + +if __name__ == "__main__": + num = input("Enter a number: ") + count(int(num)) \ No newline at end of file diff --git a/Online Store/README.md b/Online Store/README.md new file mode 100644 index 0000000..2e053cd --- /dev/null +++ b/Online Store/README.md @@ -0,0 +1,3 @@ +# Online Store + +wip \ No newline at end of file diff --git a/Online Store/__init__.py b/Online Store/__init__.py new file mode 100644 index 0000000..a576777 --- /dev/null +++ b/Online Store/__init__.py @@ -0,0 +1 @@ +# don't modify this file \ No newline at end of file diff --git a/Online Store/main.py b/Online Store/main.py new file mode 100644 index 0000000..7d21476 --- /dev/null +++ b/Online Store/main.py @@ -0,0 +1,53 @@ +prices_dict = { + "grapes": 200, + "oranges": 400, + "apples": 600 +} + +def get_discounted_prices(*prices: int) -> float: + # make a set from the passed arguments to avoid duplicates + prices_set = set(prices) + + # if there's still more than three values in the set, raise an error + if len(prices_set) > 3: + raise ValueError("This function only takes up to three arguments.") + + # add the prices together + price_sum = sum(prices) + # https://seafsh.cc/u/HR0thZ.png + + # apply discounts for the sum + if len(prices_set) == 3: + return float(price_sum * 0.75) + + elif len(prices_set) == 2: + return float(price_sum * 0.9) + + else: + return float(price_sum) + +def print_row(item: str, price: str, bold: bool = False) -> None: + # ANSI color codes + blue = "\033[34m" # Blue + green = "\033[32m" # Green + bold_s = "\033[1m" if bold is True else "" # Bold, use an empty string instead of None, because None will be converted to a string by print() + reset = "\033[0m" # Reset to default color + + # apply ansi styling for bold, then blue, then offset the first string by 25 characters to the left. + # reset formatting, then do the same thing for the second string but with green as the + # ansi color code instead of blue and offsetting to the right + print(f" {bold_s}{blue}{item:<25}{reset} {bold_s}{green}{price:>25}{reset}") + +if __name__ == '__main__': + print("Online Store") + print("⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯") + print_row("Products", "Price", True) + print_row("Grapes", get_discounted_prices(prices_dict["grapes"])) + print_row("Orange", get_discounted_prices(prices_dict["oranges"])) + print_row("Apple", get_discounted_prices(prices_dict["apples"])) + print_row("Grapes & Oranges Combo", get_discounted_prices(prices_dict["grapes"], prices_dict["oranges"])) + print_row("Oranges & Apples Combo", get_discounted_prices(prices_dict["oranges"], prices_dict["apples"])) + print_row("Grapes & Apples Combo", get_discounted_prices(prices_dict["grapes"], prices_dict["apples"])) + print_row("Fruit Gift Pack", get_discounted_prices(prices_dict["grapes"], prices_dict["apples"], prices_dict["oranges"])) + print("⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯") + print("For delivery Contact: (987) 646-78899") # lol? \ No newline at end of file