Skip to content

Instantly share code, notes, and snippets.

@loriopatrick
Created January 27, 2013 08:58
Show Gist options
  • Save loriopatrick/4647468 to your computer and use it in GitHub Desktop.
Save loriopatrick/4647468 to your computer and use it in GitHub Desktop.
A simple method to convert ISBN13 to ISBN10.
def isbn_13_to_10 (isbn):
count = 0
isbn = isbn[3:12]
for x in range(0, 9):
count += int(isbn[x]) * (10 - x)
z = (11 - (count % 11)) % 11
if (z == 10):
z = 'X'
return isbn + str(z)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment