![]() The algorithm is useful to determine if a card. If checkSum is divisible by 10, it is valid. Transcribed image text: In 1954, Hans Luhn of IBM proposed an algorithm for validating credit card numbers. Sum all digits:ĬheckSum = sum ( card_number ) # 8. Add the checkDigit back to the list:Ĭard_number. Subtract 9 at even indices if digit is over 9Ĭard_number = # 6. Double digits at even indicesĬard_number = # 5. Reverse the remaining digits:Ĭard_number. Remove the last digit:ĬheckDigit = card_number. Change datatype to listĬard_number = # 2.
0 Comments
Leave a Reply. |