Last active
July 23, 2016 12:26
-
-
Save amateusz/cc7bae1eba85c3444a5361a952b5ec95 to your computer and use it in GitHub Desktop.
opaski_suma_kontrolna.py
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 checksum(numer): | |
lista = list(map(int, str(numer))) # słowem kodowanym jest pojedyncza cyfra. | |
ret = 0 | |
for _ in lista: | |
ret ^= _ | |
return ret | |
# niech numer będzie numer plus doklejona cyfra checksumy czyli: | |
numer*10 + cyfrachecksum |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment