Implement the Luhn Algorithm - Implement the Luhn Algorithm

Tell us what’s happening:

I haven’t started yet as I am mainly confused by what the third part is supposed to mean in the instructions? the “sum 2-char digits” part? I don’t really understand how the 10 drops down to a 1, how the 18 drops down to a 9 and how a 16 drops to a 7.

Your code so far

def verify_card_number(digits):
    pass

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36 Edg/146.0.0.0

Challenge Information:

Implement the Luhn Algorithm - Implement the Luhn Algorithm

You have to follow the instructions given.
So how does 18 become 9 for eg? Here are the instructions:

  • If the result of doubling a digit is greater than 9, sum the digits to get a single digit. Alternatively, you can subtract 9 from the result.

Ask yourself, is the 18 greater than 9? (yes)
Then add 1 and 8 together => 9

1 Like