CREDIT CARD VERIFIER (LUHN’S ALGORITHM)
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
Other Videos By One Person Studio
2023-05-06 | OMELETTE #shorts #animation |
2023-05-06 | ECHO |
2023-05-06 | BOROS #shorts #art #drawing |
2023-05-06 | MEGA BLAZIKEN #shorts #art #drawing |
2023-05-06 | THINKING & TESTING: HOW MANY "WORD"? |
2023-05-06 | SKETCHBOOK TOUR PART CXVI #shorts #art #drawing |
2023-05-05 | SONIC #shorts #art #drawing |
2023-05-05 | GIRL XXV #shorts #art #drawing |
2023-05-05 | SCOOBY-DOO #shorts #art #drawing |
2023-05-05 | RICK #shorts #art #drawing |
2023-05-05 | CREDIT CARD VERIFIER (LUHN’S ALGORITHM) |
2023-05-05 | BUCKET #shorts #blender #animation |
2023-05-04 | ROD WAVE #shorts #art #drawing |
2023-05-04 | APPLE AND ORANGE |
2023-05-04 | MEWTWO #shorts #art #drawing |
2023-05-04 | RED #shorts #art #drawing |
2023-05-04 | GRADING STUDENTS |
2023-05-04 | MOTORCYCLE II #shorts #blender #animation |
2023-05-04 | SKETCHBOOK TOUR PART CXV #shorts #art #drawing |
2023-05-03 | CATERPIE #shorts #art #drawing |
2023-05-03 | CATERPIE #shorts #art #drawing |