Skip to content

Commit 7113ed9

Browse files
committed
Complete file handling bug fixes
1 parent fd1130d commit 7113ed9

30 files changed

+269
-75
lines changed

bash.exe.stackdump

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Stack trace:
2+
Frame Function Args
3+
0007FFFF8E80 00021005FE8E (000210285F68, 00021026AB6E, 000000000000, 0007FFFF7D80) msys-2.0.dll+0x1FE8E
4+
0007FFFF8E80 0002100467F9 (000000000000, 000000000000, 000000000000, 0007FFFF9158) msys-2.0.dll+0x67F9
5+
0007FFFF8E80 000210046832 (000210286019, 0007FFFF8D38, 000000000000, 000000000000) msys-2.0.dll+0x6832
6+
0007FFFF8E80 000210068CF6 (000000000000, 000000000000, 000000000000, 000000000000) msys-2.0.dll+0x28CF6
7+
0007FFFF8E80 000210068E24 (0007FFFF8E90, 000000000000, 000000000000, 000000000000) msys-2.0.dll+0x28E24
8+
0007FFFF9160 00021006A225 (0007FFFF8E90, 000000000000, 000000000000, 000000000000) msys-2.0.dll+0x2A225
9+
End of stack trace
10+
Loaded modules:
11+
000100400000 bash.exe
12+
7FFFBFEA0000 ntdll.dll
13+
7FFFBE1C0000 KERNEL32.DLL
14+
7FFFBCFD0000 KERNELBASE.dll
15+
7FFFBE6D0000 USER32.dll
16+
7FFFBD520000 win32u.dll
17+
7FFFBE6A0000 GDI32.dll
18+
7FFFBDAF0000 gdi32full.dll
19+
7FFFBD8C0000 msvcp_win.dll
20+
000210040000 msys-2.0.dll
21+
7FFFBD3D0000 ucrtbase.dll
22+
7FFFBE290000 advapi32.dll
23+
7FFFBE5F0000 msvcrt.dll
24+
7FFFBDF10000 sechost.dll
25+
7FFFBEA70000 RPCRT4.dll
26+
7FFFBC5E0000 CRYPTBASE.DLL
27+
7FFFBD760000 bcryptPrimitives.dll
28+
7FFFBFD00000 IMM32.DLL

buggy_anagram.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
def is_anagram(s1, s2):
2+
return sorted(s1.lower()) == sorted(s2.lower()) # Bug fixed: handle case sensitivity
3+
4+
print(is_anagram("Listen", "silent"))

buggy_average_of_squares.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
def average_of_squares(lst):
2+
return sum(x*x for x in lst) / len(lst) # Bug fixed: average of squares
3+
4+
print(average_of_squares([2, 4, 6]))

buggy_bank_account.py

Whitespace-only changes.

buggy_binary_search.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
def binary_search(arr, target):
2+
left, right = 0, len(arr) - 1 # Bug fixed: use len(arr) - 1
3+
while left <= right:
4+
mid = (left + right) // 2
5+
if arr[mid] == target:
6+
return mid
7+
elif arr[mid] < target:
8+
left = mid + 1
9+
else:
10+
right = mid - 1
11+
return -1
12+
13+
print(binary_search([1, 2, 3, 4, 5], 3))

buggy_capitalize.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
def capitalize_words(sentence):
2+
words = sentence.split(' ')
3+
# Bug fixed: modify the words list in-place
4+
for i in range(len(words)):
5+
words[i] = words[i].capitalize()
6+
return ' '.join(words)
7+
8+
print(capitalize_words("hello world python"))

buggy_count_vowels.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
def count_vowels(s):
2+
vowels = "aeiouAEIOU" # Bug fixed: handle uppercase vowels
3+
count = 0
4+
for char in s:
5+
if char in vowels:
6+
count += 1
7+
return count
8+
9+
print(count_vowels("Hello World"))

buggy_cube.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
def cube(n):
2+
return n * n * n # Bug fixed: now calculates cube
3+
4+
print(cube(3))

buggy_exponentiate.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
def exponentiate(a, b):
2+
return a ** b # Bug fixed: use exponentiation
3+
4+
print(exponentiate(2, 4))

buggy_fibonacci.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
def fibonacci(n):
2+
if n <= 1:
3+
return n
4+
return fibonacci(n-1) + fibonacci(n-2) # Bug fixed: removed extra +1
5+
6+
print(fibonacci(6))

0 commit comments

Comments
 (0)