Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #39288
| 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 | <mortenengv@gmail.com> |
| 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 | <CAJ2vgs5uzr1BHF-koYmb5s0tBSkzChTKSQ8k=pCkVC21LWXoAQ@mail.gmail.com> |
| References | <CAJ2vgs5uzr1BHF-koYmb5s0tBSkzChTKSQ8k=pCkVC21LWXoAQ@mail.gmail.com> |
| Date | Tue, 19 Feb 2013 23:59:34 +0100 |
| Subject | Re: Verification of bank number using modulus 11 |
| From | Morten Engvoldsen <mortenengv@gmail.com> |
| 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 <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2071.1361314782.2939.python-list@python.org> (permalink) |
| 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 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
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 ?
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Verification of bank number using modulus 11 Morten Engvoldsen <mortenengv@gmail.com> - 2013-02-19 23:59 +0100
csiph-web