CREDIT CARD VERIFIER (LUHN’S ALGORITHM)

Subscribers:
4,890
Published on ● Video Link: https://www.youtube.com/watch?v=2PdEBKBTeV4



Duration: 7:15
44 views
1


Your task is to read several card numbers from the input and determine whether each one is a valid card number or not.

EXPLANATION CODE:
1) This Python code begins by reading from the user an integer n, which stands for the quantity of credit card numbers to be verified. A loop that repeats n times is then entered.

2) The program receives a credit card number from the user and strips out any spaces before reading it within the loop. The Luhn method is then used by the program to verify the credit card number. A straightforward checksum method called the Luhn algorithm is used to confirm a number of identifications, including credit card numbers.

3) The Luhn algorithm operates by sliding leftward from the rightmost digit of the credit card number. Every other digit is multiplied by two, and if the outcome is higher than or equal to 10, the two digits are added together. For instance, if a digit is 5, it is multiplied by two to become 10, and the outcome is 1 + 0 = 1. When a digit is multiplied by 16 from 8, the outcome is 1 + 6 = 7.

4) The program then sums all the non-doubled digits and all the resultant digits after doubling each digit and summing each other digit. The program outputs "YES" and indicates that the credit card number is legitimate if the total is divisible by 10. If not, "NO" is shown by the program.

Contents:
0:00 - Reading
2:46 - Solving
5:38 - Explaining

#codingame #coding #game #programming #easy #difficulty #reading #arithmetic #python #pythonprogramming #learntocode #tutorial #education #problemsolving #algorithmic #asmr #asmrtyping #creditcard #credit #card #verifier







Tags:
codingame
coding
game
programming
problem solving
problem
solving
algorithmic
reading
asmr
asmr typing
education
easy difficulty
easy
difficulty
tutorial
how to program
explanation
how to
python programming
python
credit card verifier
credit
card
verifier
luhn's algorithm
luhn
algortithm