Skip to content

Commit 58369b3

Browse files
docs: Add 25 GitHub issue templates for project improvements
- Created comprehensive issue templates in .github/ISSUES_TO_CREATE/ - Includes bugs, enhancements, features, documentation, and refactoring - Added INDEX.md with priority recommendations and categorization - Issues cover all difficulty levels (beginner to advanced) Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
1 parent 862cefb commit 58369b3

32 files changed

Lines changed: 7072 additions & 152 deletions
Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
# 🔴 CRITICAL BUGS - Priority: HIGH
2+
3+
---
4+
5+
## Issue #1: Prime Number Checker Has Inverted Logic
6+
7+
### Title
8+
[BUG]: Prime number checker returns incorrect results
9+
10+
### Description
11+
12+
**What:** The prime number checking algorithm in `basics/03_control_flow/02_check_prime.py` has a critical logic error that inverts the final result.
13+
14+
**Why it matters:** Students learning from this example will be taught incorrect logic. The program returns `False` for prime numbers and `True` for non-prime numbers.
15+
16+
**Where:** `basics/03_control_flow/02_check_prime.py`, lines 13-16
17+
18+
**Current behavior:**
19+
```python
20+
# Lines 13-16 - Logic is inverted
21+
if(prime):
22+
prime = False # Bug: This makes primes return False!
23+
else:
24+
prime = True # Bug: This makes non-primes return True!
25+
```
26+
27+
**Expected behavior:**
28+
- Input `7` should return `True` (is prime)
29+
- Input `10` should return `False` (not prime)
30+
31+
**Suggested approach:**
32+
Remove lines 13-16 entirely. The logic before this already correctly sets the `prime` variable.
33+
34+
**Acceptance criteria:**
35+
- [ ] Remove the inverted logic block (lines 13-16)
36+
- [ ] Test with prime numbers: 2, 3, 5, 7, 11 → should return `True`
37+
- [ ] Test with non-prime numbers: 4, 6, 8, 9, 10 → should return `False`
38+
- [ ] Test edge cases: 0, 1, negative numbers → should return `False`
39+
40+
**Labels:** `bug`, `priority: high`, `good first issue`
41+
42+
---
43+
44+
## Issue #2: Function Named 'sum' Performs Division
45+
46+
### Title
47+
[BUG]: Function `sum()` in error handling example performs division instead of addition
48+
49+
### Description
50+
51+
**What:** In `basics/09_error_handling/01_try_except.py`, the function named `sum` actually performs division, which is misleading and confusing.
52+
53+
**Why it matters:** This violates basic naming conventions and will confuse beginners learning about functions and error handling.
54+
55+
**Where:** `basics/09_error_handling/01_try_except.py`, lines 1-3
56+
57+
**Current behavior:**
58+
```python
59+
def sum(a: int, b: int) -> int: # Name suggests addition
60+
result = a / b # But performs division!
61+
return result
62+
```
63+
64+
**Expected behavior:** Function name should match its operation.
65+
66+
**Suggested approach:**
67+
Rename the function to `divide` and update the type hint to return `float`:
68+
69+
```python
70+
def divide(a: int, b: int) -> float:
71+
result = a / b
72+
return result
73+
```
74+
75+
**Acceptance criteria:**
76+
- [ ] Rename function from `sum` to `divide`
77+
- [ ] Update return type hint to `float`
78+
- [ ] Update function call on line 16
79+
- [ ] Add docstring explaining the function
80+
81+
**Labels:** `bug`, `refactor`, `good first issue`, `priority: medium`
82+
83+
---
84+
85+
## Issue #3: No Input Validation in Guess Number Game
86+
87+
### Title
88+
[BUG]: Guess number game crashes on non-integer input
89+
90+
### Description
91+
92+
**What:** The guess number game (`basics/11_projects/01_guess_number.py`) has no try/except handling for invalid input, causing crashes when users enter non-integer values.
93+
94+
**Why it matters:** Poor user experience - the game crashes instead of prompting for valid input.
95+
96+
**Where:** `basics/11_projects/01_guess_number.py`, line 10
97+
98+
**Current behavior:**
99+
```python
100+
user_input = int(input(f"Guess the Number: ")) # Crashes on "abc"
101+
```
102+
103+
**Expected behavior:** Should catch `ValueError` and prompt user to enter a valid number.
104+
105+
**Suggested approach:**
106+
Wrap the input in a try/except block:
107+
108+
```python
109+
try:
110+
user_input = int(input(f"Guess the Number: "))
111+
except ValueError:
112+
print("Please enter a valid number!")
113+
continue
114+
```
115+
116+
**Acceptance criteria:**
117+
- [ ] Add ValueError handling around int() conversion
118+
- [ ] Display friendly error message on invalid input
119+
- [ ] Allow user to try again without crashing
120+
- [ ] Test with inputs: "abc", "12.5", "", special characters
121+
122+
**Labels:** `bug`, `enhancement`, `good first issue`
123+
124+
---
125+
126+
## Issue #4: Rock Paper Scissors Has No Input Validation
127+
128+
### Title
129+
[BUG]: Rock paper scissors game crashes on invalid input
130+
131+
### Description
132+
133+
**What:** The rock-paper-scissors game (`basics/11_projects/03_rock_paper_scissors.py`) doesn't validate user input before using `.upper()` and doesn't handle invalid choices.
134+
135+
**Why it matters:** Game returns "Something Wents Wrong" for any input other than R, P, S.
136+
137+
**Where:** `basics/11_projects/03_rock_paper_scissors.py`, lines 10-26
138+
139+
**Suggested approach:**
140+
Add input validation loop:
141+
142+
```python
143+
while True:
144+
userinput = input("R - Rock\nP - Paper\nS - Scissor\nChoose: ").upper()
145+
if userinput in ["R", "P", "S"]:
146+
break
147+
print("Invalid choice! Please choose R, P, or S.")
148+
```
149+
150+
**Acceptance criteria:**
151+
- [ ] Validate input is one of R, P, S
152+
- [ ] Loop until valid input is received
153+
- [ ] Fix typo: "Wents" → "Went"
154+
- [ ] Add case-insensitive handling
155+
156+
**Labels:** `bug`, `enhancement`, `good first issue`
157+
158+
---
159+
160+
## Issue #5: File Handling Examples Use Non-Existent Files
161+
162+
### Title
163+
[BUG]: File handling examples reference files that don't exist
164+
165+
### Description
166+
167+
**What:** Multiple file handling examples reference files like `poems.txt`, `newfile.txt` without checking if they exist first or creating them.
168+
169+
**Why it matters:** Examples fail when run, confusing beginners.
170+
171+
**Where:**
172+
- `basics/07_file_handling/01_file_handling_basics.py` - `newfile.txt`
173+
- `basics/07_file_handling/07_file_find_word.py` - `poems.txt`
174+
175+
**Suggested approach:**
176+
Add file existence check and creation:
177+
178+
```python
179+
import os
180+
181+
filename = "poems.txt"
182+
if not os.path.exists(filename):
183+
with open(filename, "w") as f:
184+
f.write("Twinkle, twinkle, little star...")
185+
```
186+
187+
**Acceptance criteria:**
188+
- [ ] Add os.path.exists() checks before reading
189+
- [ ] Create sample files if they don't exist
190+
- [ ] Add comment explaining the check
191+
- [ ] Test on fresh clone (no existing files)
192+
193+
**Labels:** `bug`, `enhancement`, `good first issue`
194+
195+
---
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
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: []
5+
---
6+
7+
## Bug Description
8+
9+
The prime number checking logic in `basics/03_control_flow/02_check_prime.py` is inverted, causing incorrect results.
10+
11+
## Problem
12+
13+
The final if-else block has the logic reversed:
14+
15+
```python
16+
if(prime):
17+
prime = False # This should be True
18+
else:
19+
prime = True # This should be False
20+
```
21+
22+
## Expected Behavior
23+
24+
- Prime numbers (2, 3, 5, 7, 11, etc.) should return `True`
25+
- Non-prime numbers should return `False`
26+
27+
## Current Behavior
28+
29+
- Prime numbers return `False`
30+
- Non-prime numbers return `True`
31+
32+
## Files Affected
33+
34+
- `basics/03_control_flow/02_check_prime.py`
35+
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
45+
```
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`

0 commit comments

Comments
 (0)