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

  Creat an intrest account for amazon

Write a program with subclass InterestAccount and CDAccount. The driver program (Account.java) must perform following transactions.

  More complex problem, develop a complete solution

Your algorithm will keep track of a customer's purchases at the local fireworks stand. Customers will not know exactly how many items they will purchase, so using a For loop on this lab is not allowed. Let's keep the rules simple.

  Explaining options to begin troubleshooting

Which two options should you use to begin troubleshooting?

  How many block of main memory is needed-direct mapped cache

Suppose a computer using direct mapped cache has 2^32 words of main memory and a cache of 1024 blocks, where each cache block contains 32 words. How many block of main memory are there?

  Create a flash movie that animates two figures

Create a flash movie that plays a sound clip of some music continuously while the movie plays

  Discuss why an organization might elect to use a separate

Why is the system-human interface one of the most important but difficult areas of safety-critical systems? Do a search on the Internet and find three good sources of information relating to how to design an effective system-human interface.

  Handles people entering an amusement park

GUI program that handles people entering an Amusement Park through the main gate.  Use Radio buttons and/or check boxes. A customer is Over 65, Under 12, or has a Season Pass (age doesn't matter). A ticket for the day for each of these types of custo..

  Outline the major differences between the structure of a

write a two to three 2-3 page paper in which youq1. outline the main differences between the structure of a relational

  Initialize the array with the appropriate number of values

Calculate the sum of the total miles you spent running over the 10 weeks. Calculate the average number of miles you ran.

  Standard analog-to-digital sampling rate in synchronous time

Iif synchronous time division multiplexing is used, along with standard analog-to-digital sampling rate, and each sample is converted into 8-bit value?

  What is disruptive social change in economics

What is disruptive social change in economics and how does that affect society?

  What are the advantages and disadvantages of a global labor

As the economy globalizes, would it be beneficial for labor movements to become global as well? For information on one international labor movement, go to the following website: http://www.uniglobalunion.org/. What are the advantages and disadvantage..

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