The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 398 Weeks Ago, 2 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
Universal Product Code Check Digit Verification Program
A check digit is a digit added to a string of digits that is derived from other digits in the string. Check digits provide a form of redundancy of information, used for determining if any of the digits in the string are incorrect or misread. The Universal Product Code on almost all purchase items utilizes a bar code to allow for the scanning of items. Below the bar code is the sequence of digits that the bar code encodes, as illustrated below.

The last digit of the product code (2) is a check digit computed as follows,
1. Add up all digits in the odd numbered positions (first, third, fifth, etc., starting with the leftmost digit)
excluding the last check digit, and multiply the result by 3,
0 + 6 + 0 + 2 + 1 + 5 = 14, 14 * 3 = 42
2. Add up all digits in the even numbered positions (second, fourth, etc.) excluding the last check digit,
3 + 0 + 0 + 9 + 4 = 16
3. Take the sum of the two previous results mod 10,
(42 + 16) mod 10 = 58 mod 10 = 8
4. Subtract the result from 10 to get the checksum digit.
10 - 8 = 2
Develop and test a Python program that verifies the check digit of Universal Product Codes.
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll