Last active
August 29, 2015 14:16
-
-
Save eaydin/d9a7cfc7b15033787e8d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def parity_check(incoming, type="even"): | |
| """Pass the incoming bits as string""" | |
| if type != "even" and type != "odd": | |
| return -1 | |
| if type == "even": | |
| sum = 0 | |
| if type == "odd": | |
| sum = 1 | |
| for i in incoming: sum += int(i) | |
| return sum % 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment