Re: Verification of bank number using modulus 11

2013-02-20 Thread Morten Engvoldsen
Hi, Thanks for below code: After this code: isbn = isbn[:-1] if len(isbn) != 10: return False Add: if isbn[4:6] == "00": isbn = isbn[6:] It is working exactly how it should :) I didn't even change that part . The zip function automatically truncates to the length of the shorter input seq

Re: Verification of bank number using modulus 11

2013-02-19 Thread Ian Kelly
On Tue, Feb 19, 2013 at 3:59 PM, Morten Engvoldsen 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.17

Re: Verification of bank number using modulus 11

2013-02-19 Thread Morten Engvoldsen
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 = s

Re: Verification of bank number using modulus 11

2013-02-19 Thread MRAB
On 2013-02-19 20:50, Morten Engvoldsen wrote: 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. 8607947 is a valid account number. All banks apply a modulus-based method for the validation

Re: Verification of bank number using modulus 11

2013-02-19 Thread Ian Kelly
On Tue, Feb 19, 2013 at 1:50 PM, Morten Engvoldsen wrote: > 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

Re: Verification of bank number using modulus 11

2013-02-19 Thread Dave Angel
On 02/19/2013 03:50 PM, Morten Engvoldsen wrote: 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. 8607947 is a valid account number. All banks apply a modulus-based method for the validation

Verification of bank number using modulus 11

2013-02-19 Thread Morten Engvoldsen
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. 8607947 is a valid account number. All banks apply a modulus-based method for the validation of the account structure. The 10-digit account numb