Question: If you could help answer this question, that would be great! 1. Task Write a file named credit_card.py containing a single function, check. Check accepts

If you could help answer this question, that would be great!

If you could help answer this question, that would be great! 1.Task Write a file named credit_card.py containing a single function, check. Check

1. Task Write a file named credit_card.py containing a single function, check. Check accepts a single input -a positive integer. It returns Tr ue if the integer represents a valid credit card number. As with all functions that return a bool value, if it does not return True it should return False. Credit card numbers have what is called a check digit. This is a simple way of detecting common mis-typings of card numbers. The algorithm is as follows: 1. Form a sum of every other digit, including the right-most digit; so 5490123456789128 (5490123456789128) sums to 4+0+2+ 4+6+8+1+8 33. 2. Double each remaining digit, then sum all the digits that creates it, the remaining digits (59 1357 9 2) in our example (5490123456789128) double to 10 18 2 6 10 14 18 4, which sums to 1+0 1 +8 + 2 + 6 + 1+0 3. Add the two sums above (3337 70) 4. If the result is a multiple of 10 (i.e., its last digit is 0) then it was a valid credit card number. 1 +4 + 1+8 + 4 = 37 In addition to functional correctness, some points will be reserved for 1. having good variable names 2. having meaningful docstrings for all functions you write 1. Task Write a file named credit_card.py containing a single function, check. Check accepts a single input -a positive integer. It returns Tr ue if the integer represents a valid credit card number. As with all functions that return a bool value, if it does not return True it should return False. Credit card numbers have what is called a check digit. This is a simple way of detecting common mis-typings of card numbers. The algorithm is as follows: 1. Form a sum of every other digit, including the right-most digit; so 5490123456789128 (5490123456789128) sums to 4+0+2+ 4+6+8+1+8 33. 2. Double each remaining digit, then sum all the digits that creates it, the remaining digits (59 1357 9 2) in our example (5490123456789128) double to 10 18 2 6 10 14 18 4, which sums to 1+0 1 +8 + 2 + 6 + 1+0 3. Add the two sums above (3337 70) 4. If the result is a multiple of 10 (i.e., its last digit is 0) then it was a valid credit card number. 1 +4 + 1+8 + 4 = 37 In addition to functional correctness, some points will be reserved for 1. having good variable names 2. having meaningful docstrings for all functions you write

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!