![destinyhope4776](/avatars/45874.jpg)
destinyhope4776
14.11.2019 •
Computers and Technology
Write a file named credit_card.py containing a single function, check. check accepts a single input – a positive integer. it returns true 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:
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.
double each remaining digit, then sum all the digits that creates it; the remaining digits (5 9 1 3 5 7 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 + 1+4 + 1+8 + 4 = 37
add the two sums above (33 + 37 = 70)
if the result is a multiple of 10 (i.e., its last digit is 0) then it was a valid credit card number.
Solved
Show answers
More tips
- H Horoscopes, Magic, Divination Where Did Tarot Cards Come From?...
- S Style and Beauty How to Make Your Lips Fuller? Ideas and Tips for Beautiful Lips...
- S Style and Beauty How are artificial nails removed?...
- F Family and Home How to Sew Curtain Tapes: Best Tips from Professionals...
- H Horoscopes, Magic, Divination How to Cast a Love Spell on a Guy? Guide for Guys...
- F Family and Home How to Properly Use a Water Level?...
- L Legal consultation What Documents Are Required for a Russian Passport?...
- H Health and Medicine How to Treat Styes: Causes, Symptoms, and Home Remedies...
- F Family and Home Protect Your Home or Apartment from Pesky Ants...
- T Travel and tourism Lost in the Catacombs: What to Do?...
Answers on questions: Computers and Technology
- M Mathematics Which equation is represented by the graph below? Y 5 4 + 3 لا لا 2 1 + A+++ + -5 4 -3 -2 -1 -11 1 2 3 4 5 x -2+ -3+ - 4 + -5 + y=e* +5 y = ex +4 O y = In X+4...
- B Business In testing the existence assertion for an asset, an auditor ordinarily works from the a.) potentially unrecorded items to the financial statements. b.) financial statements to the...
Ответ:
, , tik tok , snap , insta , if your bad or do some interes stuff try Yt
have a good day ,
Ya BoI XsAvAgE, <
never forget the name ^
Explanation: