Skip to content

Commit 221a051

Browse files
docs: Replace issue templates with focused, practical issues
- Removed 25 verbose templates - Added 20 focused, actionable issues - Categories: bugs, security, cleanup, docs, enhancements - Each issue has clear problem, fix, and testing instructions Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
1 parent ef12b86 commit 221a051

21 files changed

Lines changed: 1137 additions & 210 deletions
Lines changed: 20 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,41 @@
11
---
2-
title: "BUG: Prime number checker has inverted logic in basics/03_control_flow/02_check_prime.py"
3-
labels: ["bug", "good first issue"]
4-
assignees: []
2+
title: "BUG: Prime number checker returns incorrect results"
3+
labels: ["bug", "good first issue", "priority: high"]
54
---
65

76
## Bug Description
87

9-
The prime number checking logic in `basics/03_control_flow/02_check_prime.py` is inverted, causing incorrect results.
8+
The prime number checker in `basics/03_control_flow/02_check_prime.py` has inverted logic that returns wrong results.
109

1110
## Problem
1211

13-
The final if-else block has the logic reversed:
14-
12+
In the final if-else block (lines 13-16):
1513
```python
1614
if(prime):
17-
prime = False # This should be True
15+
prime = False # Wrong! Should be True
1816
else:
19-
prime = True # This should be False
17+
prime = True # Wrong! Should be False
2018
```
2119

2220
## Expected Behavior
2321

24-
- Prime numbers (2, 3, 5, 7, 11, etc.) should return `True`
25-
- Non-prime numbers should return `False`
26-
27-
## Current Behavior
22+
| Input | Expected | Actual |
23+
|-------|----------|--------|
24+
| 7 | True | False |
25+
| 10 | False | True |
26+
| 2 | True | False |
2827

29-
- Prime numbers return `False`
30-
- Non-prime numbers return `True`
28+
## Fix
3129

32-
## Files Affected
30+
Remove lines 13-16 entirely. The logic before this block already sets `prime` correctly.
3331

32+
## Files
3433
- `basics/03_control_flow/02_check_prime.py`
3534

36-
## Suggested Fix
37-
38-
Swap the assignments in the final if-else block:
39-
40-
```python
41-
if(prime):
42-
prime = True
43-
else:
44-
prime = False
35+
## Testing
36+
```bash
37+
cd basics/03_control_flow
38+
python 02_check_prime.py
39+
# Enter 7 → should show True
40+
# Enter 10 → should show False
4541
```
46-
47-
Or simply remove the final if-else block entirely since the logic is already correct before it.
48-
49-
## How to Test
50-
51-
1. Run the script with input `7` (prime number) - should output `True`
52-
2. Run the script with input `10` (non-prime) - should output `False`
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
title: "BUG: Function named 'sum()' performs division instead of addition"
3+
labels: ["bug", "good first issue"]
4+
---
5+
6+
## Bug Description
7+
8+
The function `sum()` in `basics/09_error_handling/01_try_except.py` performs division instead of addition, which is confusing and incorrect.
9+
10+
## Problem
11+
12+
```python
13+
def sum(a: int, b: int) -> int:
14+
result = a / b # This is division, not addition!
15+
return result
16+
```
17+
18+
Issues:
19+
1. Function named `sum` but divides
20+
2. Type hint says `-> int` but division returns `float`
21+
3. Misleading for learners
22+
23+
## Fix
24+
25+
Rename function to `divide()` and fix the type hint:
26+
27+
```python
28+
def divide(a: int, b: int) -> float:
29+
result = a / b
30+
return result
31+
```
32+
33+
## Files
34+
- `basics/09_error_handling/01_try_except.py`
35+
36+
## Testing
37+
```bash
38+
cd basics/09_error_handling
39+
python 01_try_except.py
40+
# Enter 10 and 2 → should show 5.0 (division makes sense here)
41+
```
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: "BUG: Debug output in first hello world example"
3+
labels: ["bug", "good first issue"]
4+
---
5+
6+
## Bug Description
7+
8+
The very first file beginners run (`basics/01_introduction/01_hello_world.py`) has debug output that should be removed.
9+
10+
## Problem
11+
12+
```python
13+
print("ram") # Debug output - should be removed
14+
print("Hello World")
15+
```
16+
17+
## Expected
18+
19+
Only print "Hello World"
20+
21+
## Fix
22+
23+
Remove line 1:
24+
```python
25+
print("Hello World")
26+
```
27+
28+
## Files
29+
- `basics/01_introduction/01_hello_world.py`
30+
31+
## Why Important
32+
33+
This is the first program beginners run. Extra output is confusing and looks like a mistake.
34+
35+
## Testing
36+
```bash
37+
cd basics/01_introduction
38+
python 01_hello_world.py
39+
# Should only output: Hello World
40+
```
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
title: "BUG: Flask debug mode enabled in production code"
3+
labels: ["bug", "security", "priority: high"]
4+
---
5+
6+
## Bug Description
7+
8+
The Flask REST API has debug mode enabled, which is a security risk.
9+
10+
## Problem
11+
12+
In `rest_api/main.py` (line 71):
13+
```python
14+
if __name__ == "__main__":
15+
app.run(debug=True) # Security risk!
16+
```
17+
18+
## Security Risk
19+
20+
Debug mode allows:
21+
- Interactive code execution
22+
- Detailed error exposure
23+
- Should NEVER be in production
24+
25+
## Fix
26+
27+
Use environment variable:
28+
29+
```python
30+
import os
31+
32+
if __name__ == "__main__":
33+
debug = os.environ.get("FLASK_DEBUG", "False").lower() == "true"
34+
app.run(debug=debug)
35+
```
36+
37+
## Files
38+
- `rest_api/main.py`
39+
40+
## Testing
41+
```bash
42+
cd rest_api
43+
python main.py
44+
# Should run with debug=False by default
45+
```
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
title: "BUG: Guess number game crashes on non-integer input"
3+
labels: ["bug", "good first issue"]
4+
---
5+
6+
## Bug Description
7+
8+
The guess number game crashes when user enters non-integer input.
9+
10+
## Problem
11+
12+
In `basics/11_projects/01_guess_number.py`:
13+
```python
14+
user_input = int(input(f"Guess the Number: ")) # Crashes on "abc"
15+
```
16+
17+
## Error
18+
19+
```
20+
ValueError: invalid literal for int() with base 10: 'abc'
21+
```
22+
23+
## Fix
24+
25+
Add input validation:
26+
27+
```python
28+
while True:
29+
try:
30+
user_input = int(input(f"Guess the Number: "))
31+
break
32+
except ValueError:
33+
print("Please enter a valid number!")
34+
```
35+
36+
## Files
37+
- `basics/11_projects/01_guess_number.py`
38+
39+
## Testing
40+
```bash
41+
cd basics/11_projects
42+
python 01_guess_number.py
43+
# Enter "abc" → should show error, not crash
44+
# Enter "50" → should work normally
45+
```
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
title: "BUG: Rock paper scissors crashes on invalid input"
3+
labels: ["bug", "good first issue"]
4+
---
5+
6+
## Bug Description
7+
8+
The rock paper scissors game crashes or behaves unexpectedly on invalid input.
9+
10+
## Problem
11+
12+
In `basics/11_projects/03_rock_paper_scissors.py`:
13+
- No input validation
14+
- Assumes user enters "rock", "paper", or "scissors"
15+
16+
## Expected
17+
18+
Should handle invalid input gracefully:
19+
```
20+
Enter your choice (rock/paper/scissors): dragon
21+
Invalid choice! Please enter rock, paper, or scissors.
22+
```
23+
24+
## Fix
25+
26+
Add input validation loop:
27+
28+
```python
29+
while True:
30+
user = input("Enter your choice (rock/paper/scissors): ").lower()
31+
if user in ["rock", "paper", "scissors"]:
32+
break
33+
print("Invalid choice! Try again.")
34+
```
35+
36+
## Files
37+
- `basics/11_projects/03_rock_paper_scissors.py`
38+
39+
## Testing
40+
```bash
41+
cd basics/11_projects
42+
python 03_rock_paper_scissors.py
43+
# Enter "dragon" → should show error message
44+
# Enter "rock" → should work normally
45+
```
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
title: "CLEANUP: Remove duplicate Python files in basics/"
3+
labels: ["cleanup", "good first issue"]
4+
---
5+
6+
## Issue
7+
8+
Many directories have duplicate files - same code exists twice with different names.
9+
10+
## Example
11+
12+
In `basics/01_introduction/`:
13+
- `01_hello_world.py`
14+
- `hello_world_first.py` ← Duplicate
15+
16+
This pattern exists across all basics folders (~110 duplicate files total).
17+
18+
## Problem
19+
20+
- Confusing for learners (which file to run?)
21+
- Harder to maintain
22+
- Bloated repository
23+
24+
## Fix
25+
26+
Keep only numbered files (e.g., `01_*.py`), delete descriptive names.
27+
28+
## Files to Check
29+
30+
| Directory | Duplicates |
31+
|-----------|------------|
32+
| 01_introduction | 2 |
33+
| 02_variables_types | 13 |
34+
| 03_control_flow | 10 |
35+
| 04_functions | 11 |
36+
| 05_data_structures | 21 |
37+
| 06_strings | 8 |
38+
| 07_file_handling | 13 |
39+
| 08_oop | 15 |
40+
| 10_advanced | 11 |
41+
| 11_projects | 6 |
42+
43+
## Testing
44+
After cleanup, verify README examples still work:
45+
```bash
46+
cd basics/01_introduction
47+
python 01_hello_world.py # Should still work
48+
```
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
title: "CLEANUP: Remove __pycache__ folders and .pyc files"
3+
labels: ["cleanup", "good first issue"]
4+
---
5+
6+
## Issue
7+
8+
Repository contains `__pycache__` folders and `.pyc` files that should be in `.gitignore`.
9+
10+
## Problem
11+
12+
These are auto-generated Python bytecode files:
13+
- Not needed in repository
14+
- Increase repo size
15+
- Can cause confusion
16+
17+
## Fix
18+
19+
1. Delete all `__pycache__/` folders
20+
2. Delete all `*.pyc` files
21+
3. Verify `.gitignore` includes:
22+
```
23+
__pycache__/
24+
*.pyc
25+
*.pyo
26+
.venv/
27+
```
28+
29+
## Command to Clean
30+
31+
```bash
32+
# Find and remove all __pycache__ folders
33+
find . -type d -name "__pycache__" -exec rm -rf {} +
34+
35+
# Find and remove all .pyc files
36+
find . -name "*.pyc" -delete
37+
```
38+
39+
## Prevention
40+
41+
Update `.gitignore` if not already present.

0 commit comments

Comments
 (0)