Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'else:': 0.03; '"if': 0.09; '8bit%:2': 0.09; 'subject:number': 0.09; 'subject:using': 0.09; 'cc:addr:python-list': 0.10; 'def': 0.10; 'altered': 0.16; 'isbn': 0.16; 'team,': 0.18; 'code,': 0.18; 'code.': 0.20; 'cc:2**0': 0.23; 'to:2**1': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'skip:( 20': 0.28; 'skip:& 10': 0.29; 'code': 0.31; 'implement': 0.32; 'to:no real name:2**1': 0.32; 'could': 0.32; 'received:74.125.82': 0.33; '"")': 0.33; 'skip:& 20': 0.33; 'received:google.com': 0.34; 'thanks': 0.34; 'false': 0.35; 'but': 0.36; 'received:74.125': 0.36; 'subject:: ': 0.38; 'skip:" 10': 0.40; 'skip:n 10': 0.63; 'validate': 0.65; 'account': 0.67; '8bit%:21': 0.69; '10th': 0.84; 'subject:Verification': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=ej5WfqG3ZZROVyRE/lWCJmgA4EzlnCYyu/B6YtNW9xY=; b=pVS/8M1fmumAQkSCBSokoEBaRO0ZcXpenlR3gdDz+71TLbODF+I8GH7d+IDVcfUf84 JfkXIpIt13sWW78ToihbqdK0Yxuos19XkQhnqAqS98N85x419XmosQWzdIUNGNHkh3KJ DqVJ/PYyAXQTg8dlbairQAn2XR+/vk1eFShocjsiN1jGjBSwlF3GvUUjEcHMmruoWYN8 6CYC5UCGBKR5PovUl6klo791SH/JRevgxQVfAtoelX3+J+fsrgRL1WIywu9M/VQKuETO dnzaQtMgCZ3hqTylZe8k5bxxe1sc7h6eBdI+J+QSMuBFabUEPPViO3MjVd8Ih0RLUYI3 KzxQ== MIME-Version: 1.0 X-Received: by 10.194.235.6 with SMTP id ui6mr29911675wjc.12.1361314774410; Tue, 19 Feb 2013 14:59:34 -0800 (PST) In-Reply-To: References: Date: Tue, 19 Feb 2013 23:59:34 +0100 Subject: Re: Verification of bank number using modulus 11 From: Morten Engvoldsen To: ian.g.kelly@gmail.com, python@mrabarnett.plus.com Content-Type: multipart/alternative; boundary=089e01493bd08e655704d61bcb90 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 72 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1361314782 news.xs4all.nl 6845 [2001:888:2000:d::a6]:60472 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:39288 --089e01493bd08e655704d61bcb90 Content-Type: text/plain; charset=ISO-8859-1 Hi Team, Thanks for the code. I have altered the code with below code, it is able to validate the number now, def calc_checkdigit(isbn): isbn = isbn.replace(".", "") check_digit = int(isbn[-1]) isbn = isbn[:-1] if len(isbn) != 10: return False weights = [5, 4, 3, 2, 7, 6, 5, 4, 3, 2] result = sum(w * (int(x)) for w, x in zip(weights, isbn)) remainder = result % 11 if remainder == 0: check = 0 else: check = 11 - remainder return check == check_digit calc_checkdigit(""8601.11.**17947"") 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 ? --089e01493bd08e655704d61bcb90 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi Team,
Thanks for the code.
=A0I have altered th= e code with below code, it is able to validate the number now,
= =A0
def calc_checkdigit(isbn):
isbn =3D isbn.replace(= ".", "")
check_digit =3D int(isbn[-1])
isbn =3D isbn[:-1]
= if len(isbn) !=3D 10:
=A0 return False
w= eights =3D [5, 4, 3, 2, 7, 6, 5, 4, 3, 2]
result =3D sum(w * (int(x)) fo= r w, x in zip(weights, isbn))
remainder =3D result % 11
if remainder =3D=3D 0:
=A0=A0 check = =3D 0
else:
=A0=A0=A0check =3D 11 - remainder
return check =3D=3D check_digit
=A0
calc_checkdigit(&q= uot;"8601.11.17947"")
=A0
=A0
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 dig= it of the account number."

which means if account number is "8601.00.179= 47" then check digit is calculate as=A0

=A0result= =3D (1*5) + (7*4)+ (9*3)+(4*2)

remainder =3D result %= 11

check_digit =3D 11 - remainder

Can you tell me how can i i= mplement this ?

=A0


=A0

=A0
--089e01493bd08e655704d61bcb90--