A Vehicle Identification Number, or VIN, is assigned to every car in the U.S. and Canada....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
A Vehicle Identification Number, or VIN, is assigned to every car in the U.S. and Canada. To help improve inventory quality, many car companies validate VIN numbers that are entered into their systems. A valid VIN must contain exactly 17 characters. Valid characters are the digits 0-9 and the upper-case letters, excluding the letters I, O, and Q. Once we know the VIN contains the correct number of valid characters, we can verify the VIN using the following VIN Checksum Algorithm. Step 1: Assign a number to each character in the VIN. The characters 0-9 are assigned their normal numeric value. Each letter in the VIN is assigned a value using the following table Letter A B CD EF G H J K L M Number 1 2 3 4 5 6 7 8 1 2 3 4 Letter N P R Number 5 7 9 S2 T U V W 3 4 5 6 X7 Y 8 69 Example: VIN 1 F T R X 1 2 V 6 9 F A 1 1 2 4 2 Number 1 6 39 7 1 2 5 6 9 6 1 1 1 2 4 2 Step 2: Compute Weighted Products Apply a weight to each number, based on its position. Weights are per the following table. Position 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Weight 8 7 6 5 4 3 2 10 0 9 8 7 6 5 4 3 2 Example: Position VIN Number Weight Weighted Products 70 1 1 8 80 F 1567 2TM 3 3RG5 9 6 5. 5113 AX74 18 45 28 3 42 62 2 V 2 5 2 10 715 8 9 QF600 aaa9 006 60 10 11 12 A 21 13. 14 1 8 17 1 1 2 6 5 5 4 6222 144 42 15 16 3 st 4 50 0 81 48 7 6 5 8 12 4 Step 3: Compute the Sum of the Weighted Products Example: 8+42+18+45 +28+3+4+50+0+81 +48+7+6+5+8+12+4=369 Step 4: Calculate the Check Value The check value is the sum of the weighted products, mod 11 Example: Check Value = 369 % 11 = 6 Step 5: Compare the Check Value to the VIN's Check Digit Position 8 in the VIN is a Check Digit. It should match the Check Value. If the Check Value is 10, then the VIN's Check Digit should be X. Example: Assignment Position 8 of the VIN is 6 Check Value = 6 Since these two numbers are the same, the VIN is valid. Write a function named validateVIN that takes a VIN as a string and returns True if the VIN is valid and returns False if the VIN is invalid. Additional Requirements Your program must be saved in a file named vinValidator.py. Your program is to contain exactly one function. That function must me named validateVIN and must take exactly one string parameter, for the VIN. Your program should not contain a main () function. Your program should not read any input from the user. Your program should not print anything. A Vehicle Identification Number, or VIN, is assigned to every car in the U.S. and Canada. To help improve inventory quality, many car companies validate VIN numbers that are entered into their systems. A valid VIN must contain exactly 17 characters. Valid characters are the digits 0-9 and the upper-case letters, excluding the letters I, O, and Q. Once we know the VIN contains the correct number of valid characters, we can verify the VIN using the following VIN Checksum Algorithm. Step 1: Assign a number to each character in the VIN. The characters 0-9 are assigned their normal numeric value. Each letter in the VIN is assigned a value using the following table Letter A B CD EF G H J K L M Number 1 2 3 4 5 6 7 8 1 2 3 4 Letter N P R Number 5 7 9 S2 T U V W 3 4 5 6 X7 Y 8 69 Example: VIN 1 F T R X 1 2 V 6 9 F A 1 1 2 4 2 Number 1 6 39 7 1 2 5 6 9 6 1 1 1 2 4 2 Step 2: Compute Weighted Products Apply a weight to each number, based on its position. Weights are per the following table. Position 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Weight 8 7 6 5 4 3 2 10 0 9 8 7 6 5 4 3 2 Example: Position VIN Number Weight Weighted Products 70 1 1 8 80 F 1567 2TM 3 3RG5 9 6 5. 5113 AX74 18 45 28 3 42 62 2 V 2 5 2 10 715 8 9 QF600 aaa9 006 60 10 11 12 A 21 13. 14 1 8 17 1 1 2 6 5 5 4 6222 144 42 15 16 3 st 4 50 0 81 48 7 6 5 8 12 4 Step 3: Compute the Sum of the Weighted Products Example: 8+42+18+45 +28+3+4+50+0+81 +48+7+6+5+8+12+4=369 Step 4: Calculate the Check Value The check value is the sum of the weighted products, mod 11 Example: Check Value = 369 % 11 = 6 Step 5: Compare the Check Value to the VIN's Check Digit Position 8 in the VIN is a Check Digit. It should match the Check Value. If the Check Value is 10, then the VIN's Check Digit should be X. Example: Assignment Position 8 of the VIN is 6 Check Value = 6 Since these two numbers are the same, the VIN is valid. Write a function named validateVIN that takes a VIN as a string and returns True if the VIN is valid and returns False if the VIN is invalid. Additional Requirements Your program must be saved in a file named vinValidator.py. Your program is to contain exactly one function. That function must me named validateVIN and must take exactly one string parameter, for the VIN. Your program should not contain a main () function. Your program should not read any input from the user. Your program should not print anything.
Expert Answer:
Answer rating: 100% (QA)
Heres a Python implementation of the validateVIN function that follows the given requirements python ... View the full answer
Related Book For
International Marketing And Export Management
ISBN: 9781292016924
8th Edition
Authors: Gerald Albaum , Alexander Josiassen , Edwin Duerr
Posted Date:
Students also viewed these business communication questions
-
Discuss which organizational structure (i.e. functional, product-market divisional, matrix) you would recommend Guelph General Hospital implement, assuming the hospital moves forward with the...
-
Some Practice Problems for the C++ Exam and Solutions for the Problems The problems below are not intended to teach you how to program in C++. You should not attempt them until you believe you have...
-
rn Explain in some detail how the Precision Tree calculations in Figure 6.11 for the Acme problem are exactly the same as those for the hand-drawn decision tree in Figure 6.6. In other words, explain...
-
What is the present value of the following? a. A$ 300 perpetuity discounted back to the present at 8 percent b. A$ 1,000 perpetuity discounted back to the present at 12 percent c. A$ 100 perpetuity...
-
Explain how the government can run budget deficitsthat is, spend more than it receives in tax revenue.
-
A decision taken at the design stage (during the pre-production phase) could well commit the business to costs during the post-production phase. Can you suggest a potential cost that could be built...
-
Elizabeth Burke wants to develop a model to more effectively plan production for the next year. Currently, PLE has a planned capacity of producing 9,100 mowers each month, which is approximately the...
-
Super Neat Snacks has two divisions, Chips and Cookies. The managers of each division are evaluated based on Residual Income. They are each given the opportunity to invest in a new project....
-
What are the different ways to approach development in economics? What is the importance of the HDI (The Human Development Index) to implement a series of actions regarding development? 2. about the...
-
Define what the "medical loss ratio" provision of the Affordable Care Act is. Part 2: Give three (3) examples that would qualify for the medical loss ratio and three (3) examples that would not...
-
In terms of one that are the new emergency manager for this scenario and one was recently promoted to the position... all of the peers applied for the role too and were not selected.So, what kind of...
-
Division C makes a part that it sells to customers outside of the company. Data concerning this part appear below: Selling price to outside customers Variable cost per unit Total fixed costs Capacity...
-
Identified how the Christian worldview is evident in two of the Strategic Priorities, reflect on what you have learned throughout this course by answering the following questions: What did you...
-
The voltage v(t) = 359.3 cos( wt) volts is applied to a load consisting of a 10-W resistor in parallel with a capacitive reactance XC = 25 W. Calculate (a) The instantaneous power absorbed by the...
-
What types of inventory issues Starbucks might reflect upon at the end of each year? The mission of Starbucks is to inspire and nurture the human spiritone person, one cup, and one neighborhood at a...
-
For each of the accounts listed below, indicate whether the account is increased by a debit or a credit: Accounts Receivable Supplies Expense Cash Equipment Common Stock Dividends Building...
-
For each of the accounts listed below, indicate whether the account is increased by a debit or a credit: Accounts Receivable Sales Revenue Equipment Common Stock Notes Payable Retained Earnings...
-
In the three columns, enter debit or credit to describe the journal entry necessary to increase and decrease the account shown to the left, and indicate which side of the account represents its...
Study smarter with the SolutionInn App