diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000..41394dd --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,24 @@ +# https://docs.astral.sh/ruff +name: ci +on: + push: + # branches: [main] + pull_request: + branches: [main] + workflow_dispatch: +jobs: + codespell: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + - run: pipx run codespell + ruff_check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + - run: pipx run ruff check --output-format=github + ruff_format: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + - run: pipx run ruff format diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml new file mode 100644 index 0000000..4132681 --- /dev/null +++ b/.github/workflows/black.yml @@ -0,0 +1,26 @@ +name: πŸ–€ Black Formatter + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + format: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Black + run: pip install black + + - name: Run Black + run: black . diff --git a/.github/workflows/updated-readme.yml b/.github/workflows/updated-readme.yml new file mode 100644 index 0000000..cda3cb6 --- /dev/null +++ b/.github/workflows/updated-readme.yml @@ -0,0 +1,38 @@ +name: 🧠 Update README Stats + +on: + push: + branches: [main] + schedule: + - cron: '0 0 * * *' # Every day at midnight + +jobs: + update-readme: + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Count Python files and lines + run: | + PY_FILES=$(find . -name "*.py" | wc -l) + TOTAL_LINES=$(find . -name "*.py" -exec cat {} + | wc -l) + echo "PY_FILES=$PY_FILES" >> $GITHUB_ENV + echo "TOTAL_LINES=$TOTAL_LINES" >> $GITHUB_ENV + + - name: Update README.md + run: | + STATS="πŸ“„ Total lines of code: $TOTAL_LINES\n🐍 Number of Python files: $PY_FILES" + DATE="πŸ•’ Last updated: $(date -u +"%Y-%m-%d %H:%M UTC")" + + sed -i "//,//c\\\n$STATS\n" README.md + sed -i "//,//c\\\n$DATE\n" README.md + + - name: Commit changes + run: | + git config --global user.name "GitHub Actions Bot" + git config --global user.email "actions@github.com" + git add README.md + git commit -m "🧠 Update README stats" + git push diff --git a/README.md b/README.md index 8779b0e..0a9a3a6 100644 --- a/README.md +++ b/README.md @@ -17,3 +17,13 @@ Each one is a small step toward becoming a full-stack developer. ## πŸ“† Day Counter ✨ **Day 8 of Learning Python** ✨ + +πŸ“„ Total lines of code: 1280 +🐍 Number of Python files: 21 + + + +πŸ•’ Last updated: 2025-09-20 00:59 UTC + + + diff --git a/classes_objs.py b/classes_objs.py index b6fb0a4..57ea97d 100644 --- a/classes_objs.py +++ b/classes_objs.py @@ -108,22 +108,18 @@ def animal_speak(animal): animal_speak(pferd) # Neigh animal_speak(eule) # Hoot - - ### Try Area ## Basic Functions -''' -functions are simple, and does'nt include any aparameters or return values -and performs a single task, like so...; -''' -def greet(): - print("Hallo, Leute!") +""" +Functions are simple, don't include any parameters or return values, +and perform a single task, like so... +""" +def greet_group(): + print("Hallo, Leute!") -## Functions with parameters -#: functions accepting parameters are more flexible and readable. -def greet(name): +def greet_person(name): print(f"Hallo, {name}") @@ -156,7 +152,7 @@ def add_all(*args): # With *args return sum(args) print(add_all(1, 2, 3, 4, 5)) -def print_info(**kwargs) # With **kwargs +def print_info(**kwargs): # With **kwargs for key, value in kwargs.items(): print(f"{key}: {value}") diff --git a/index2.py b/index2.py index d1fb772..f9db210 100644 --- a/index2.py +++ b/index2.py @@ -68,7 +68,7 @@ def add_to_total(num): ### Try 7 ##:Use loops and functions to eliminate duplication. ''' -users = ["Herr Goethe", "Frau Merkel", "Frau Ine", "Herr Geoff"] +users = ["Herr Goethe", "Frau Merkel", "Frau Lines", "Herr Geoff"] # - better βœ” @@ -235,7 +235,7 @@ def greet_users(users): ''' ###:F-Strings -##:Formatted strin literals +##:Formatted string literals ##{f-strings} make formatting strings easier and more readable than the traditional format() method. '''name = 'Henry' age = 18 diff --git a/intro.py b/intro.py index 13cd174..289c250 100644 --- a/intro.py +++ b/intro.py @@ -39,10 +39,10 @@ alt = "18" vollName = vorName +" "+ nachName -print("Mein Vorname ist " + vorName) -print("Mein Nachname ist " + nachName) -print("Meine Alter ist " + alt) -print("Mein Name in voll ist " + vollName)""" +print("Mein Vorname is " + vorName) +print("Mein Nachname is " + nachName) +print("Meine Alter is " + alt) +print("Mein Name in voll is " + vollName)""" ######### Avoiding Type Errors With STR() Function ####### """alt = 18 @@ -316,7 +316,7 @@ # print(my_foods) # print(friends_foods) -##### ORGANIZING A LIST --- SORTIN A LIST ###### +##### ORGANIZING A LIST --- SORTING A LIST ###### #cars = ["bmw", "audi", "toyota", "subaru"] # cars.sort() # #print(cars) diff --git a/simple_py_program/Rechner.py b/simple_py_program/Rechner.py index 01ed240..6cae6b1 100644 --- a/simple_py_program/Rechner.py +++ b/simple_py_program/Rechner.py @@ -14,8 +14,8 @@ if zahl2 != 0: ergebnis = zahl1 / zahl2 else: - ergebnis = "Teilen durch Null(0) ist nicht erlaubt" + ergebnis = "Teilen durch Null(0) is nicht erlaubt" else: ergebnis = "Syntaxfehler!" -print("Ergebnis:", ergebnis) \ No newline at end of file +print("Ergebnis:", ergebnis) diff --git a/simple_py_program/passwort.py b/simple_py_program/passwort.py index 20afc5b..63388cb 100644 --- a/simple_py_program/passwort.py +++ b/simple_py_program/passwort.py @@ -1,9 +1,10 @@ -#####Practice 4 -##Simple Password Checker -Passwort_prΓΌfen = input("Passwort eingeben: ") -hat_Nummer = any(char.isdigit() for char in Passwort_prufen) +##### Practice 4 +## Simple Password Checker -if len(Passwort_prΓΌfen) > 8 and hat_Nummer: +password = input("Passwort eingeben: ") +has_number = any(char.isdigit() for char in password) + +if len(password) > 8 and has_number: print("starkes Passwort") else: - print("schwaches Passwort!, Versuch es noch einmal...") \ No newline at end of file + print("schwaches Passwort! Versuch es noch einmal...") diff --git a/simple_python_problem/solve2.py b/simple_python_problem/solve2.py index ee261ac..f666e07 100644 --- a/simple_python_problem/solve2.py +++ b/simple_python_problem/solve2.py @@ -17,7 +17,7 @@ gen_Message += "\nThe party will take place at a newly allocated hall, more info's later.\n" print(gen_Message) -##Add three more guests, one at the beggining[0], middle[?], and end of your list +##Add three more guests, one at the beginning[0], middle[?], and end of your list invited_Friends.insert(0, "Maxwell") #Beginning invited_Friends.insert(2, "Thomas") #Middle invited_Friends.insert(5, "Joseph") #End diff --git a/simple_python_problem/solve_5.py b/simple_python_problem/solve_5.py index 51dd49a..8e6a1e9 100644 --- a/simple_python_problem/solve_5.py +++ b/simple_python_problem/solve_5.py @@ -1,8 +1,8 @@ ########### ASSIGNMENT 5 #################### ## Make a list of your three favorite fruits, -# and then write a series of independent if statements tha check for certain fruits in your list -# Write five if statement. Each should check whether a certain kind of fruit is in your list -# If the fruit is in your list, the if block should print a statement, such as "You like Banana" +# and then write a series of independent if statements that checks for certain fruits in your list. +# Write five if statement. Each should check whether a certain kind of fruit is in your list. +# If the fruit is in your list, the if block should print a statement, such as "You like Bananas" fav_Fruits = ["Orange", "Mango", "Pawpaw"] @@ -13,7 +13,7 @@ if "Mango" in fav_Fruits: print("Henry likes Mangoes") if "Lemon" in fav_Fruits: - print("Henry like Lemon") + print("Henry like Lemons") if "Pawpaw" in fav_Fruits: print("Henry likes Pawpaw") -print("\nAll Done") +print("\nAll Done!") diff --git a/simple_python_problem/solve_8.py b/simple_python_problem/solve_8.py index 07f98f6..6646005 100644 --- a/simple_python_problem/solve_8.py +++ b/simple_python_problem/solve_8.py @@ -12,6 +12,6 @@ friends_Phones.append("Iphone") -##Prove that you have two separate lists and print a message with the separarte lists +##Prove that you have two separate lists and print a message with the separate lists print(phones) -print(friends_Phones) \ No newline at end of file +print(friends_Phones)