Skip to content

Commit 94574de

Browse files
authored
Merge pull request #1 from ModuleMaster64/main
Improvements for Learning-Python - ModuleMaster64 (formally known as M1ddleM1n)
2 parents d1f07df + 67bfdf4 commit 94574de

File tree

12 files changed

+130
-35
lines changed

12 files changed

+130
-35
lines changed

.github/workflows/CI.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# https://docs.astral.sh/ruff
2+
name: ci
3+
on:
4+
push:
5+
# branches: [main]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
jobs:
10+
codespell:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v5
14+
- run: pipx run codespell
15+
ruff_check:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v5
19+
- run: pipx run ruff check --output-format=github
20+
ruff_format:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v5
24+
- run: pipx run ruff format

.github/workflows/black.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: 🖤 Black Formatter
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
format:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: '3.11'
21+
22+
- name: Install Black
23+
run: pip install black
24+
25+
- name: Run Black
26+
run: black .
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: 🧠 Update README Stats
2+
3+
on:
4+
push:
5+
branches: [main]
6+
schedule:
7+
- cron: '0 0 * * *' # Every day at midnight
8+
9+
jobs:
10+
update-readme:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repo
15+
uses: actions/checkout@v3
16+
17+
- name: Count Python files and lines
18+
run: |
19+
PY_FILES=$(find . -name "*.py" | wc -l)
20+
TOTAL_LINES=$(find . -name "*.py" -exec cat {} + | wc -l)
21+
echo "PY_FILES=$PY_FILES" >> $GITHUB_ENV
22+
echo "TOTAL_LINES=$TOTAL_LINES" >> $GITHUB_ENV
23+
24+
- name: Update README.md
25+
run: |
26+
STATS="📄 Total lines of code: $TOTAL_LINES\n🐍 Number of Python files: $PY_FILES"
27+
DATE="🕒 Last updated: $(date -u +"%Y-%m-%d %H:%M UTC")"
28+
29+
sed -i "/<!-- STATS:START -->/,/<!-- STATS:END -->/c\\<!-- STATS:START -->\n$STATS\n<!-- STATS:END -->" README.md
30+
sed -i "/<!-- UPDATED:START -->/,/<!-- UPDATED:END -->/c\\<!-- UPDATED:START -->\n$DATE\n<!-- UPDATED:END -->" README.md
31+
32+
- name: Commit changes
33+
run: |
34+
git config --global user.name "GitHub Actions Bot"
35+
git config --global user.email "[email protected]"
36+
git add README.md
37+
git commit -m "🧠 Update README stats"
38+
git push

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,13 @@ Each one is a small step toward becoming a full-stack developer.
1717
## 📆 Day Counter
1818
**Day 8 of Learning Python**
1919

20+
<!-- STATS:START -->
21+
📄 Total lines of code: 1280
22+
🐍 Number of Python files: 21
23+
<!-- STATS:END -->
24+
25+
<!-- UPDATED:START -->
26+
🕒 Last updated: 2025-09-20 00:59 UTC
27+
<!-- UPDATED:END -->
28+
29+

classes_objs.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,22 +108,18 @@ def animal_speak(animal):
108108
animal_speak(pferd) # Neigh
109109
animal_speak(eule) # Hoot
110110

111-
112-
113111
### Try Area
114112

115113
## Basic Functions
116-
'''
117-
functions are simple, and does'nt include any aparameters or return values
118-
and performs a single task, like so...;
119-
'''
120-
def greet():
121-
print("Hallo, Leute!")
114+
"""
115+
Functions are simple, don't include any parameters or return values,
116+
and perform a single task, like so...
117+
"""
122118

119+
def greet_group():
120+
print("Hallo, Leute!")
123121

124-
## Functions with parameters
125-
#: functions accepting parameters are more flexible and readable.
126-
def greet(name):
122+
def greet_person(name):
127123
print(f"Hallo, {name}")
128124

129125

@@ -156,7 +152,7 @@ def add_all(*args): # With *args
156152
return sum(args)
157153
print(add_all(1, 2, 3, 4, 5))
158154

159-
def print_info(**kwargs) # With **kwargs
155+
def print_info(**kwargs): # With **kwargs
160156
for key, value in kwargs.items():
161157
print(f"{key}: {value}")
162158

index2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def add_to_total(num):
6868
### Try 7
6969
##:Use loops and functions to eliminate duplication.
7070
'''
71-
users = ["Herr Goethe", "Frau Merkel", "Frau Ine", "Herr Geoff"]
71+
users = ["Herr Goethe", "Frau Merkel", "Frau Lines", "Herr Geoff"]
7272
7373
# - better ✔
7474
@@ -235,7 +235,7 @@ def greet_users(users):
235235
'''
236236

237237
###:F-Strings
238-
##:Formatted strin literals
238+
##:Formatted string literals
239239
##{f-strings} make formatting strings easier and more readable than the traditional format() method.
240240
'''name = 'Henry'
241241
age = 18

intro.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@
3939
alt = "18"
4040
vollName = vorName +" "+ nachName
4141
42-
print("Mein Vorname ist " + vorName)
43-
print("Mein Nachname ist " + nachName)
44-
print("Meine Alter ist " + alt)
45-
print("Mein Name in voll ist " + vollName)"""
42+
print("Mein Vorname is " + vorName)
43+
print("Mein Nachname is " + nachName)
44+
print("Meine Alter is " + alt)
45+
print("Mein Name in voll is " + vollName)"""
4646

4747
######### Avoiding Type Errors With STR() Function #######
4848
"""alt = 18
@@ -316,7 +316,7 @@
316316
# print(my_foods)
317317
# print(friends_foods)
318318

319-
##### ORGANIZING A LIST --- SORTIN A LIST ######
319+
##### ORGANIZING A LIST --- SORTING A LIST ######
320320
#cars = ["bmw", "audi", "toyota", "subaru"]
321321
# cars.sort()
322322
# #print(cars)

simple_py_program/Rechner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
if zahl2 != 0:
1515
ergebnis = zahl1 / zahl2
1616
else:
17-
ergebnis = "Teilen durch Null(0) ist nicht erlaubt"
17+
ergebnis = "Teilen durch Null(0) is nicht erlaubt"
1818
else:
1919
ergebnis = "Syntaxfehler!"
2020

21-
print("Ergebnis:", ergebnis)
21+
print("Ergebnis:", ergebnis)

simple_py_program/passwort.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
#####Practice 4
2-
##Simple Password Checker
3-
Passwort_prüfen = input("Passwort eingeben: ")
4-
hat_Nummer = any(char.isdigit() for char in Passwort_prufen)
1+
##### Practice 4
2+
## Simple Password Checker
53

6-
if len(Passwort_prüfen) > 8 and hat_Nummer:
4+
password = input("Passwort eingeben: ")
5+
has_number = any(char.isdigit() for char in password)
6+
7+
if len(password) > 8 and has_number:
78
print("starkes Passwort")
89
else:
9-
print("schwaches Passwort!, Versuch es noch einmal...")
10+
print("schwaches Passwort! Versuch es noch einmal...")

simple_python_problem/solve2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
gen_Message += "\nThe party will take place at a newly allocated hall, more info's later.\n"
1818
print(gen_Message)
1919

20-
##Add three more guests, one at the beggining[0], middle[?], and end of your list
20+
##Add three more guests, one at the beginning[0], middle[?], and end of your list
2121
invited_Friends.insert(0, "Maxwell") #Beginning
2222
invited_Friends.insert(2, "Thomas") #Middle
2323
invited_Friends.insert(5, "Joseph") #End

0 commit comments

Comments
 (0)