Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #39289
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.057 |
| X-Spam-Evidence | '*H*': 0.89; '*S*': 0.00; '"if': 0.09; 'subject:number': 0.09; 'subject:using': 0.09; 'truncate': 0.09; 'isbn': 0.16; 'sequence,': 0.16; 'sequence.': 0.16; 'wrote:': 0.17; 'input': 0.18; 'feb': 0.19; 'header:In-Reply-To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'all.': 0.28; 'function': 0.30; 'implement': 0.32; 'could': 0.32; 'shorter': 0.33; 'to:addr :python-list': 0.33; 'code:': 0.33; 'received:google.com': 0.34; 'thanks': 0.34; 'false': 0.35; 'pm,': 0.35; 'received:209.85.220': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'should': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'skip:" 10': 0.40; 'account': 0.67; '10th': 0.84; '2013': 0.84; 'add:': 0.84; 'subject:Verification': 0.84; 'to:name:python': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=mpC1VqFloZ25qnHy67n31/Zu1s7vU3uBPkBzNoxQ6qs=; b=PQsLPfnbLHL3jO+kRAEsL7uSmGHVsQbMJSyYHtW4/EwMFKHdFU/sYc+nOkMhPKmiMA 3dWhNmLnCOZJ+ftJYFrMFepijRbeDPDm10fQHwZmB105UnfrPnoKFb9Fg5zXy2eX0Gox d0V4wnx0VWbhyT+C6cRorRY6G+m6ZYMZ7V08o+9kvMDQCW5lRCDoi2zLfahe+YG33Ffx Ll4ItVoxRD8+bzO3zDaedG2MdTlBwjtgWlKpB0vsRd/rdHWWBU4wrcTzPGO4Lmj7ASt0 e/FhKbHDEEdef5JXwwMYMtk37QxhLgzcrBlYQc/qtYWydrHGoHK9NhfvVQzZVyi1Uf0W IdFQ== |
| X-Received | by 10.68.244.162 with SMTP id xh2mr44534776pbc.55.1361316136996; Tue, 19 Feb 2013 15:22:16 -0800 (PST) |
| MIME-Version | 1.0 |
| In-Reply-To | <CAJ2vgs4rPwYyA-V4eWZaVVHEkmWEZj+QSMV3eNJTCD6ALwg23w@mail.gmail.com> |
| References | <CAJ2vgs5uzr1BHF-koYmb5s0tBSkzChTKSQ8k=pCkVC21LWXoAQ@mail.gmail.com> <CAJ2vgs4rPwYyA-V4eWZaVVHEkmWEZj+QSMV3eNJTCD6ALwg23w@mail.gmail.com> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Tue, 19 Feb 2013 16:21:35 -0700 |
| Subject | Re: Verification of bank number using modulus 11 |
| To | Python <python-list@python.org> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| 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.2072.1361316140.2939.python-list@python.org> (permalink) |
| Lines | 32 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1361316140 news.xs4all.nl 6921 [2001:888:2000:d::a6]:42770 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:39289 |
Show key headers only | View raw
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.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Verification of bank number using modulus 11 Ian Kelly <ian.g.kelly@gmail.com> - 2013-02-19 16:21 -0700
csiph-web