subject
Geography, 25.07.2019 01:30 huangjianhe135

Question 3 (15% of this assignment): (financial: credit card number validation) credit card numbers follow certain patterns: it must have between 13 and 16 digits, and the number must start with: 4 for visa cards 5 for mastercard credit cards 37 for american express cards 6 for discover cards in 1954, hans luhn of ibm proposed an algorithm for validating credit card numbers. the algorithm is useful to determine whether a card number is entered correctly or whether a credit card is scanned correctly by a scanner. credit card numbers are generated following this validity check, commonly known as the luhn check or the mod 10 check, which can be described as follows (for illustration, consider the card number 4388576018402626): 1. double every second digit from right to left. if doubling of a digit results in a twodigit number, add up the two digits to get a single-digit number. 4388576018402626 2 = 4 2 = 4 4* 2 = 8 * 2 = 2 6 * 2 = 12 (1 + 2 = 3) 5* 2 = 10 (1 + 0 = 1) 8 * 2 = 16 (1 + 6 = 7) 4 * 2 = 8 2. now add all single-digit numbers from step 1. 4 + 4 + 8 + 2+ 3+ 1 + 7 + 8 = 37 3. add all digits in the odd places from right to left in the card number. 6 + 6 + 0 + 8 + 0 + 7 + 8 + 3 = 38 4. sum the results from steps 2 and 3. 37 + 38 = 75 5. if the result from step 4 is divisible by 10, the card number is valid; otherwise, it is invalid. for example, the number 4388576018402626 is invalid, but the number 4388576018410707 is valid. write a program that prompts the user to enter a credit card number as an integer. display whether the number is valid or invalid. design your program to use the following functions: # return true if the card number is valid def isvalid (number): # get the result from step 2 def sumofdouble evenplace (number): # return this number if it is a single digit, otherwise, return # the sum of the two digits def getdigit(number): # return sum of odd place digits in number def sumo foddplace (number):

ansver
Answers: 1

Another question on Geography

question
Geography, 23.06.2019 05:10
Give three differences between oceanic and continental crust brainliest will be awarded
Answers: 2
question
Geography, 23.06.2019 09:00
All of the following came out of china and were exchanged along the silk road, except a. papermaking b. block printing c. buddhism d. compasses select the best answer from the choices provided a b c d
Answers: 2
question
Geography, 24.06.2019 10:00
Many somalian refugees sought entrance to the united states in 2006 and 2007. describe factors that encoura somalians to leave their country in the 1990s and 2000s
Answers: 3
question
Geography, 24.06.2019 15:00
Which of the following physical characteristics best explains the climate of the area that is circled in black on the climate map above?
Answers: 1
You know the right answer?
Question 3 (15% of this assignment): (financial: credit card number validation) credit card number...
Questions
question
Mathematics, 03.02.2020 05:45
Questions on the website: 13722363