You will write the two halves of a parity check: the sender's part, which adds the parity bit, and the receiver's part, which checks a byte. The bits are held in a string such as "1011001", as in the strings chapter of the Python books.
Your tasks.
add_parity, return the byte: the parity bit followed by the seven data bits. kind is "even" or "odd".parity_ok, return True if the byte has the right parity for kind, and False if not.failed to the number of bytes in received that fail an even parity check.Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…