Simple way of detecting common mis-typings of card numbers

Assignment Help Basic Computer Science
Reference no: EM131229131

Write a program in python to compute if a given number is a valid credit card number.

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 sums to 8+1+8+6+4+2+0+4 = 33
  2. Form double each remaining digit, then sum all the digits that creates it; the remaining digits in our example (5 9 1 3 5 7 9 2) 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
  3. Add the two sums above (33+37 = 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.

An example run might be:

Type a credit card number (just digits): 1

1 is not a valid credit card number

Another run might be:

Type a credit card number (just digits): 240

Yes, 240 is a valid credit card number

Another run might be:

Type a credit card number (just digits): 9548

Yes, 9548 is a valid credit card number

Another run might be:

Type a credit card number (just digits): 5490123456789129

5490123456789129 is not a valid credit card number

Reference no: EM131229131

Questions Cloud

Computer system that has no operating system : What inconveniences can be faced by a user who is interacting with a computer system that has no operating system?
Sophistication to your dbms application : You may choose to add more sophistication to your DBMS application, but you are not required to do so. While the more you do, the better your performance will be judged, it is better to do the basics right, than to develop a sophisticated DBMS app..
Differences between mark''s records and the bank''s statement : Why are there differences between Mark's records and the bank's statement? What could Mark do during the next month to make the month-end reconciliation easier?
Identify the flow of events within each use case : Draw a use case diagram for the following dentist office system, but do not bother to identify the flow of events within each use case. Whenever new patients are seen for the first time, they complete a patient information form that asks their nam..
Simple way of detecting common mis-typings of card numbers : 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:
How vital was expert testimony to the case : ow vital was expert testimony to the case? How would you as the prosecutor have prepared the expert witnesses for trial? Could a conviction have been rendered without the fiber evidence? What other evidence did the prosecution present?
Encounter when examining defense perimeters : There are many scenarios one might encounter when examining defense perimeters. These include the single router, defense-in-depth, and demilitarized zone (DMZ) methods. Each has a strategic approach geared specifically toward the environment in wh..
What types of applications can this circuit be used in : What types of applications can this circuit be used in? Explain. Set the value to 45% and take the three measurements. Set the potentiometer to 0% then measure and record VGS, ID, VD.
Develop workplace policy and procedures for sustainability : BSB60215 Advanced Diploma of Business Assignment Task. Develop workplace policy and procedures for sustainability. Develop, implement and evaluate a sustainability process suitable to the workplace at Lonsdale Institute. Complete and provide written ..

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Manager must cut line items in the it budget

If an IT manager must cut line items in the IT budget, what areas do you believe should be cut, and what items do you believe should remain unaffected?

  What decimal number would the ieee 754

What decimal number would the IEEE 754 single precision floating point number 0xCAE80000 (this is in hex) be? Write your final answer in scientific notation as m x 10 p where p is an integer.

  Length of the diameter of the circle

A circle in thexyxyx, y-plane has the equation (x+92)^2+(y+54)^2=73(x+92)2+(y+54)2=73left parenthes is, x, plus, 92, right parenthesis, start superscript, 2, end superscript

  How must code generators for expressions be changed

How must code generators for expressions be changed when they are translating an AST node that has more than one parent?

  Creating a budget

Creating a BudgetCreate a current or future budget for yourself using Microsoft Excel. The budget must include the following: Four fixed costs Four variable costsAny sources of income Balance upon completion

  How many address bits are needed for each ram chip

Suppose that a 2M 16 main memory is built using 256KB 8 RAM chips and memory is word-addressable.

  Engineering and engineering technology

Explain the differences between engineering and engineering technology? What aspects of engineering technology inspired you to choose this field? (write at least 2 paragraphs)

  Wuld you make any changes to the services why or why not

answer each questions in 2 paragraphs and label the questions by the numbers.not an essay include at least one

  Month interest on the overdue balance

One of your customers is delinquent on his accounts payable balance. You've mutually agreed to a repayment schedule of $596 per month. You will charge 1.2 % per month interest on the overdue balance.

  What kind of correlation relationship exists between the two

Compare the use of the all confidence, max confidence, Kulczynski, and cosine measures with lift and correlation on the given data.

  Track of current inventory and re-orders automatically

Assignment 3 This assignment is marked out of 15. The marks will be scaled to be worth 15% for the assignment. The learning objectives are here. The due date is 26th October 2012. Question 1 High Level Architecture [20 marks] Devise an architectur..

  Prints its volume and surface area

Write an application that reads the radius of a sphere and prints its volume and surface area. Use the following formulas, in which r represents the sphere's radius. Print the output to four decimal places

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd