Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #39289 > unrolled thread

Re: Verification of bank number using modulus 11

Started byIan Kelly <ian.g.kelly@gmail.com>
First post2013-02-19 16:21 -0700
Last post2013-02-19 16:21 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Verification of bank number using modulus 11 Ian Kelly <ian.g.kelly@gmail.com> - 2013-02-19 16:21 -0700

#39289 — Re: Verification of bank number using modulus 11

FromIan Kelly <ian.g.kelly@gmail.com>
Date2013-02-19 16:21 -0700
SubjectRe: Verification of bank number using modulus 11
Message-ID<mailman.2072.1361316140.2939.python-list@python.org>
On Tue, Feb 19, 2013 at 3:59 PM, Morten Engvoldsen <mortenengv@gmail.com> wrote:
> But can you tell me how could i implement below
>
> "If digits 5 and 6 of the account number are zeros, the check digit is
> calculated on the 7, 8, 9 and 10th digit of the account number."
>
> which means if account number is "8601.00.17947" then check digit is
> calculate as
>
>  result = (1*5) + (7*4)+ (9*3)+(4*2)
>
> remainder = result % 11
>
> check_digit = 11 - remainder
>
> Can you tell me how can i implement this ?

After this code:

isbn = isbn[:-1]
if len(isbn) != 10:
  return False

Add:

if isbn[4:6] == "00":
    isbn = isbn[6:]

And that should do it.  Thanks to the symmetry of the weights
sequence, you don't even need to change that part at all.  The zip
function will automatically truncate to the length of the shorter
input sequence.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web