Starting from the rightmost digit

Assignment Help Basic Computer Science
Reference no: EM131709594

The last digit of a credit card number is the "check digit" that protects against errors. For simplicity we will use credit cards with just 8 digits instead of 16.  The user will input the 8 digit credit card number as a string and you will convert it to a list using the list() function. You need to validate the length of the string entered. If it is less than or greater than 8 characters, ask for another string. Validate the credit card number that you receive according to the following rules:

  1. Starting from the rightmost digit, form the sum of every other digit - for example, if the credit card number is 43589795 then you form the sum 5 + 7 + 8 + 3 = 23.
  2. Double each of the digits that were not included in the preceding step. Add all digits of the resulting numbers. For example, with the number given above, doubling the digits starting with the next-to-last one, yields 18 18 10 and 8. Adding all the digits in these values results 1 + 8 + 1 + 8 + 1 + 0 + 8 = 27.
  3. Add the sums of the two preceding steps. If the last digit of the result is 0, the number is valid. In the example, 23+ 27 = 50 so the number is valid.

Reference no: EM131709594

Questions Cloud

First character of the current string : If the current string's last character is I, then add U onto the end of the current string.
Discuss the potential legal and ethical issues arising : Identify and discuss the potential legal and ethical issues arising from the following fact pattern:
Regression model to predict a firm pension funding : Results of a study reported in Financial Analysts Journal include a simple linear regression analysis of firms' pension funding (Y ) versus profitability (X).
Describe an effective retention process : Create a slide presentation to serve as a learning aid for managers. Incorporate both text and images.Describe an effective retention process.
Starting from the rightmost digit : Starting from the rightmost digit, form the sum of every other digit - for example, if the credit card number is 43589795 then you form the sum
Some designs of products and services are inherently bad : Some designs of products and services are inherently bad. Read about them at the bad designs web site.
Describe what parts of gmp were violated in the given case : Type "Warning Letters" in the search engine. Write a 400 word paper summarizing case and then describe what parts of GMP were violated in that case.
Advise the liquidator on any breaches of the duty : LAWS3100 Corporations Law Questions - Advise the liquidator on any breaches of the duty(ies) to avoid insolvent trading in the Corporations Act 2001 (Cth)
Best quantity to balance ordering cost and carrying cost : Use the EOQ formula to calculate the best quantity to balance ordering cost and carrying cost.

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