00:01
In this question, the loon algorithm is used to check the validity of credit card numbers.
00:05
It involves doubling every second digit from the right, adjusting for digits greater than 9, then summing all digits.
00:12
If total sum is divisible by 10, the credit card is valid.
00:17
Now coming to the code part of this question.
00:23
First of all, we see the algorithm for this programming.
00:28
First step is, start from the rightmost digit, the check digit and moving left, double the value of every second digit.
00:37
Second one is, if doubling a digit result in a number greater than 9, then subtract 9 from that result.
00:46
Third one is, sum up all the digits including the double ones in the credit card number.
00:52
Fourth is, if the total sum is divisible by 10, then the credit card number is considered valid.
01:00
Now coming to the code part, in a python language, def loon algorithm card number, card number is equal to int digit, for digit, in card number...