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

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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