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

  Describe three utility services that a dbms should provide

What is a procedural language? What is a nonprocedural language?

  Determining the five life-cycle stages

Pick a product that fits each of the five life-cycle stages from Figure 2.8 (embryo, growth, maturity, decline, and rebirth) and recap the information you discovered in a one to two page paper. This can be one product that has gone through the fiv..

  Organization encourage positive organizational behavior

Does Google as an organization encourage positive Organizational Behavior? If yes, in what ways and give examples. 300-350 words

  Clearly indicate which variable is the lsb

Problem Statement :Design a digital circuit that detects if a 4-bit input code is a valid BCD (binary-coded decimal) code.That is, if the input value is in the range of 0-9, then the output of the circuit is 1,otherwise the output of the circuit i..

  Use the following formula to calculate a car''s mpg

C sharp Write C# code to prompt a user to enter the number of miles he or she has driven and the gallons of gas used

  Rare species of spiders

In South America, a rare species of spiders is discovered and is transplanted into a safe area. Once they are transported the population of the spider after t months is P(t) = 44( 1 + 0.7t ) / ( 3 + 0.03t )

  Fit the data and show the best fit distribution

Using Crystal Ball or another statistical package, fit the data and show the best fit distribution and the appropriate K-S or other goodness-of-fit statistic value for this data.

  Discuss which design would best fit the clients needs

Use the unit 6 seminar/project case scenario (above) and use Visio 2007 to generate a diagram for the network topology. Briefly discuss which design would best fit the client's needs.

  Questionnaire for former and potential students

1. Design a questionnaire for former and potential students in SCR's training classes. Also, reply to Jesse's message about sampling. Give her a recommendation and reasons. Be sure to explain the reasoning behind the recommendations.

  Design a data definition to represent a team event

Basketball, Beach volleyball, Field hockey, Football, Rugby sevens, and Volleyball Design a data definition to represent a team event.

  What are the main components of this process

Describe the STEP process. What are the main components of this process? 16.6 What are the major areas of Deming's PDCA process? Describe the TMM process.

  Wireless network design paper

Wireless Network Design Paper You will be designing a small wireless network for a small company, based on a given scenario. The scenario will include network assets (hardware and software), building diagrams, a list of users, and requirement ..

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