Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,16 +1,16 @@
|
|||
isISBN13 = function(n)
|
||||
n = n.replace("-","").replace(" ","")
|
||||
s = 0
|
||||
for i in range(0, n.len-1,2)
|
||||
s += n[i].val
|
||||
end for
|
||||
for i in range(1, n.len-1,2)
|
||||
s += n[i].val * 3
|
||||
end for
|
||||
return not (s % 10)
|
||||
n = n.replace("-","").replace(" ","")
|
||||
s = 0
|
||||
for i in range(0, n.len-1,2)
|
||||
s += n[i].val
|
||||
end for
|
||||
for i in range(1, n.len-1,2)
|
||||
s += n[i].val * 3
|
||||
end for
|
||||
return not (s % 10)
|
||||
end function
|
||||
|
||||
testValues = "978-0596528126 978-0596528120 978-1788399081 978-1788399083".split(" ")
|
||||
for val in testValues
|
||||
print val + " " + ["bad", "good"][isISBN13(val)]
|
||||
print val + " " + ["bad", "good"][isISBN13(val)]
|
||||
end for
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue