All problems
Hamming (7,4) Syndrome
Problem
Compute the integer syndrome of a received 7-bit word for the systematic Hamming(7,4) code. Evaluate s1 = c1^c3^c5^c7, s2 = c2^c3^c6^c7 and s4 = c4^c5^c6^c7, then return s1 + 2 * s2 + 4 * s4. The result is 0 for a valid codeword and gives the 1-indexed error position otherwise.
Hint
The syndrome bits are read as a little-endian binary position number.
Test cases
case 1
in: [[0,0,0,0,0,0,0]]
expected: 0
case 2
in: [[1,1,1,0,0,0,0]]
expected: 0
case 3
in: [[0,1,1,0,0,0,0]]
expected: 1
case 4
in: [[0,0,0,0,1,0,0]]
expected: 5
Starter codePython
def hamming74_syndrome(received):
# Your code here
pass4 test cases · run your code against them in the editor