Sha256: 0175676885f569a794bef6382591728a4c64a3f7eb5ff2f8223130b012624f88
Contents?: true
Size: 313 Bytes
Versions: 87
Compression:
Stored size: 313 Bytes
Contents
def verify(isbn): chars = list(isbn.replace('-', '')) if chars and chars[-1] == 'X': chars[-1] = '10' if not len(chars) == 10 or not all(c.isdigit() for c in chars): return False indices = list(range(10, 0, -1)) return sum(int(c) * i for c, i in zip(chars, indices)) % 11 == 0
Version data entries
87 entries across 87 versions & 1 rubygems