Skip to content

Instantly share code, notes, and snippets.

@amateusz
Last active July 23, 2016 12:26
Show Gist options
  • Save amateusz/cc7bae1eba85c3444a5361a952b5ec95 to your computer and use it in GitHub Desktop.
Save amateusz/cc7bae1eba85c3444a5361a952b5ec95 to your computer and use it in GitHub Desktop.
opaski_suma_kontrolna.py
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