Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!news.tele.dk!news.tele.dk!small.news.tele.dk!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.021 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'algorithm': 0.03; 'python': 0.09; '8bit%:2': 0.09; 'calculating': 0.09; 'subject:number': 0.09; 'subject:using': 0.09; 'advance': 0.10; 'def': 0.10; 'resulting': 0.13; '(result': 0.16; 'document:': 0.16; 'isbn': 0.16; 'multiplied': 0.16; 'structure.': 0.16; 'used."': 0.16; '\xa0def': 0.16; '\xa0here': 0.16; 'team,': 0.18; 'trying': 0.21; 'message-id:@mail.gmail.com': 0.27; 'url:cz': 0.29; 'url:download': 0.29; '"the': 0.29; '8bit%:5': 0.29; 'skip:& 10': 0.29; 'becomes': 0.30; 'could': 0.32; '"")': 0.33; 'to:addr :python-list': 0.33; 'code:': 0.33; 'received:google.com': 0.34; 'thanks': 0.34; 'false': 0.35; 'but': 0.36; 'method': 0.36; 'should': 0.36; 'to:addr:python.org': 0.39; 'apply': 0.39; 'mentioned': 0.63; 'here': 0.65; 'validate': 0.65; 'account': 0.67; '8bit%:100': 0.70; 'banks': 0.71; '11.': 0.81; '10th': 0.84; '2.7.': 0.84; '8bit%:24': 0.84; 'subject:Verification': 0.84; 'url:export': 0.84; 'norway': 0.91; 'divided': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=U/KnUlSVcyMS2RdF+xplH+bIEwBGBwVhsOREnbPrblE=; b=lAffPbFarqn2B2HkeXHB7WNScnEP9kmPBMgP1bDIV8OtvwSqG5LMMcRxYDMu9Oz0Tc 8Yd88OEEMXHcLhPycWV2h0ajjDMT4WPYSSd+13YuZ6frYgAhOuWXLYgONIdDHYJDb/Rg 7e2KtxffhmzNV1xB4qgeC6qkxapVeKBn59aX8H9BBukgDJgtOJfiSXs2Q95Lm3iCC2mB EH++zDjOdKQkEFIMfeuzErreF22VgbXao0YUX+wcb2+wNePaX+5Y9AEF+mV0SxF1pwAl jGQp4m7O20Vaq3m2t/2fl1LyCyXuC50mBEah9+vHXvc6zmUTGQctgBCuSfaHAY4hJjRs FnOw== MIME-Version: 1.0 X-Received: by 10.43.17.199 with SMTP id qd7mr8152206icb.52.1361307018845; Tue, 19 Feb 2013 12:50:18 -0800 (PST) Date: Tue, 19 Feb 2013 21:50:18 +0100 Subject: Verification of bank number using modulus 11 From: Morten Engvoldsen To: python-list@python.org Content-Type: multipart/alternative; boundary=bcaec51968c949dc7404d619fdcb 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: 125 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1361307023 news.xs4all.nl 6947 [2001:888:2000:d::a6]:53825 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:39272 --bcaec51968c949dc7404d619fdcb Content-Type: text/plain; charset=ISO-8859-1 Hi Team, I am trying to verify the account number using the following algorithm: "The valid account number is 11 numeric digit without seperator. Eg. 86011117947 is a valid account number. All banks apply a modulus-based method for the validation of the account structure. The 10-digit account number is multiplied from left to right by the following weights: 5, 4, 3, 2, 7, 6, 5, 4, 3, 2. The resulting numbers are added up and divided by 11. The remainder is subtracted from 11 and becomes the check digit. If the remainder is 0, the check digit will be 0. 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. Account numbers for which the remainder is 1 (check digit 10) cannot be used." I am trying to validate the Norway account number using the algorithm mentioned in the following document: http://www.cnb.cz/miranda2/export/sites/www.cnb.cz/cs/platebni_styk/iban/download/TR201.pdf Here is my code: def calc_checkdigit(isbn): isbn = isbn.replace(".", "") check_digit = int(isbn[-1]) isbn = isbn[:-1] if len(isbn) != 10: return False result = sum((10 - i) * (int(x) if x != 'X' else 10) for i, x in enumerate(isbn)) return (result % 11) == check_digit calc_checkdigit(""8601.11.17947"") In my program : it is calculating 10 digit with weights 10-1, but according to above algorithm the weights should be : 5, 4, 3, 2, 7, 6, 5, 4, 3, 2. Could you please let me know how can i calculate the 10 digit with weights 5, 4, 3, 2, 7, 6, 5, 4, 3, 2. I am using python 2.7. Thanks in advance team for help.. ): --bcaec51968c949dc7404d619fdcb Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi Team,
I am trying to verify the account number using the = following algorithm:
= =A0
"The valid account number is 11 numeric digit without sepera= tor. Eg. 86011117947 is a valid account number. All banks apply a modulus-b= ased method for the validation of the account structure. The 10-digit accou= nt number is multiplied from left to right by the following weights: 5, 4, = 3, 2, 7, 6, 5, 4, 3, 2. The resulting numbers are added up and divided by 1= 1. The remainder is subtracted from 11 and becomes the check digit. If the = remainder is 0, the check digit will be 0. If digits 5 and 6 of the account= number are zeros, the check digit is calculated on the 7, 8, 9 and 10th di= git of the account number. Account numbers for which the remainder is 1 (ch= eck digit 10) cannot be used."
=A0
=A0I am trying t= o validate the Norway account number using the algorithm mentioned in the f= ollowing document:
=A0
Here is my code:=
=A0def calc_checkdigit= (isbn):
=A0=A0=A0=A0=A0=A0=A0 isbn =3D isbn.replace(".", "&qu= ot;)
=A0=A0=A0=A0=A0=A0=A0 = check_digit =3D int(isbn[-1])
=A0=A0=A0=A0=A0=A0=A0 isbn =3D isbn[:-1]<= /font>
=A0=A0=A0= =A0=A0=A0=A0 if len(isbn) !=3D 10:
=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0 return False
=A0=A0=A0=A0=A0=A0=A0 result =3D sum((10 - = i) * (int(x) if x !=3D 'X' else 10) for i, x in enumerate(isbn))
=A0=A0=A0=A0=A0=A0=A0 = return (result % 11) =3D=3D check_digit
=A0
calc_checkdigit(""8601.11.17947"")=
=A0
In my program : it is calculating 10 dig= it with weights 10-1, but according to above algorithm the weights should b= e : 5, 4, 3, 2, 7, 6, 5, 4, 3, 2.=A0
=A0
Could you please let me know how can i c= alculate the 10 digit with weights 5, 4, 3, 2, 7, 6, 5, 4, 3, 2. I am using= python 2.7.
=A0
Thanks in advance team for help..=
= =A0
=A0

=A0

=A0

):

=A0

=A0
--bcaec51968c949dc7404d619fdcb--