Skip to content

Commit defaba9

Browse files
fix: Update variable names
1 parent d3649da commit defaba9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

bit_manipulation/hamming_code_generator.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,17 @@ def hamming_15_11(number: str) -> str:
7575
^ redundant_bits[4]
7676
)
7777

78-
j = -1
78+
data_index = 0
7979
r = 0
8080
redundant_bit_locations = [0, 1, 2, 4, 8]
8181
for k in range(16):
8282
if k in redundant_bit_locations:
83+
print(k)
8384
hamming_digits[k] = redundant_bits[r]
8485
r += 1
8586
else:
86-
j += 1
87-
hamming_digits[k] = digits[j]
87+
hamming_digits[k] = digits[data_index]
88+
data_index += 1
8889

8990
return "".join([str(i) for i in hamming_digits])
9091

0 commit comments

Comments
 (0)