Valid credit card number

Assignment Help Basic Computer Science
Reference no: EM131233558

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: EM131233558

Questions Cloud

Solve the given initial value problem : Consider the following. (12x2 + y- 1) - (12y-x)y' = 0,y(1) = 0. Solve the given initial value problem.
Federal courts have in reviewing federal agency actions : The doctrine that requires a party to pursue his claim through every level of an administrative agency before taking his claim to court is called: What authority do federal courts have in reviewing federal agency actions?
Determine the expected rate of return on joness stock : Debt: Jones Industries borrows $600,000 for 10 years with an annual payment of $100,000. What is the expected interest rate (cost of debt)? Determine the expected rate of return on Jones's stock (cost of equity).
Law and equity were ancient concepts in the legal system : A person who believes in the natural law theory believes that the law should reflect universal ethical and moral principles that are part of human nature or divine law. Law and equity were ancient concepts in the legal system we inherited from Englan..
Valid credit card number : 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:
Mentioned in the specification of the product : Suppose you are a senior engineer of a company that manufactures car seat for toddlers. You know that the strength of the belt of a recently designed car seat is slightly less than mentioned in the specification of the product. Your supervisor has as..
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..
Goal of employee empowerment and eliminate the issues : How could Becker use goal setting and feedback to maintain his goal of employee empowerment and eliminate the issues that have come up at The Regency Grand? Discuss specific actions he should take, and provide support for why you believe they might w..
Charge of large mailing to the alumni : You are placed in charge of a large mailing to the alumni of your university, inviting them to contribute to a scholarship fund. The letters and envelopes have been individually addressed (mailing labels were not used). Make a process chart for this ..

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Finding content of top of stack-call instruction is executed

Specify the content of PC, SP, and the top of the stack in the following situations: After the call instruction is executed.

  Develop intellectual property violation reporting procedures

Develop intellectual property violation reporting procedures.

  Activities of the employee benefit system

Alice has a high regard for privacy and wants the system to have employeesregister and give permission to obtain financial amounts from the dental insurance and retirementcompanies. Draw a use case diagram, context-level data flow diagram represen..

  Computing the mainframe computer systems

Some commentators have suggested that mainframe computer systems could be squeezed out of existence in the next few years, with the incredible advances in the capabilities of midrange systems and the power of supercomputers combining to divide up ..

  Program to strip all occurrences of characters

Write a program to strip all occurrences of these characters: '(', ')' and '-'. Also, strip all the leading and trailing whitespace characters. Display the stripped phone number

  Find out the generic format for tcp header

Suggest an extension to TCP allowing the sender of an option a way of specifying what the receiver should do if the option is not understood. List several such receiver actions that might be useful, and try to give an example application of each.

  Calculate the data rate in gb per second of herbs eyes

Each pixel is basically a superposition of five ‘‘colors'', each of which has 32 intensities. The time resolution of Herb's visual field is 10 msec. Calculate the data rate, in GB/sec, of Herb's eyes.

  Write a program that uses a while loop to compute

Write a program that prints the numbers from 1 to 50 using a for loop. Rewrite the program using a do -while loop.

  Determining the improvement of operations

What kind of an impact will FOSS have on the enterprise? Will it lead to an improvement of operations, help make better decisions, provide a competitive advantage for strategic use of IT?

  What needs to be protected and from what to protect it

In order to successfully manage risk, one must understand risk itself and the assets at risks. The way one goes about managing risk will depend on what needs to be protected, and from what to protect it.

  Inherent method of tracking state or managing sessions

Session management is used to track user activity, including the login and logout (or the beginning and end of a user session) of a Web application, otherwise known as "state." Because HTTP is a stateless technology, HTTP has no inherent method of tr..

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