Question 4 Part i The checksum letter of a 7-digits number is calculated as such: d - [Ci iz is is is io in) • (2 7 6 5 4 3 2 )] mod 11 -( 2i + 7iz + 6is + Sia + 4is + 3i6 + 2i ) mod 11 Where i, is the 1 to last of the 7 digits of the 7-digits number and (2,7.6,5,4,3,2) are the weights. The checksum is a letter which corresponds to the number d as shown in the look-up table below 10 9 7 6 4 3 2 Checksum letter A B D E G J Question da Define a function that meets the following specifications. Method name get id checksum 1. str Parameter This str contains the numerical series mentioned in the description above. The length of the str object is 7. Return value 1. str An uppercase letter Detailed description From the given string of 7 umbers, computer the number d as described in the section 'Part 1'. Return the letter which corresponds to the number d as shown in the look-up table below 10 Checksum letter A B D G Part 2 A typical vehicle registration number comes in the format xXx H y: X- prefixes wwwN - Numerical series (from 1 to 9999, without leading zeroes) y - Checksum The checksum letter is caleulated by first converting the letters into numbers, i.e., where A-1 and Z-26, and numbers to individual digits, potentially giving six individual numbers from the registration plate. However, only two letters of the prefix are used in the checksum. For a three-letter prefix, only the last two letters are used; for a two-letter prefix, both letters are used; for a single letter prefix, the single letter corresponds to the second position, with the first position as 0. For numerals less than four digits, additional zeroes are added in front as placeholders, for example "1" is "0001". SBSS 3229 would therefore give 2, 19, 3, 2, 2 and 9 (note that "S" is discarded); E 12 would give 0, 5, 0, 0, 1 and 2. SS 108 would be given as 19, 19, 0, 1, 0, 8. Each individual number is then multiplied by 6 fixed numbers (9, 4, 5, 4, 3, 2). These are added up, then divided by 19. The remainder corresponds to one of the 19 letters used (A, Z, Y, X, U, T, S, R, P, M, L, K, J, H, G, E, D, C, B), with "Á" corresponding to a remainder of corresponding to 1, "Y" corresponding to 2 and so on. In the case of SBS 3229, the final letter should be a P; for E 23, the final letter should be a H. SS 11 back letter should be a T. The letters F, I, N, O, Q, V and W are not used as checksum letters. Co. "Z"

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Question 4
Part 1
The checksum letter of a 7-digits number is calculated as such:
d = [(i, iz iz i4 is is iz) • (27 65 432)] mod 11
= ( 2in + 7iz + 6is + Si4 + 4is + 3i6 + 2i7 ) mod 11
Where i, is the 1l to last of the 7 digits of the 7-digits number and (2,7,6,5,4,3,2) are the weights.
The checksum is a letter which corresponds to the number d as shown in the look-up table below
10
7
6 5
2
4
d
Checksum
letter
9
8
3
1
A
в
D
E
F
G
J
Question 4a
Define a function that meets the following specifications.
Method name
get id checksum
Parameter
1. str
This str contains the numerical series mentioned in the description
above. The length of the str object is 7.
Return value
1.
str
An uppercase letter
Detailed deseription
From the given string of 7 numbers, computer the number d as described in
the section 'Part 1'. Returm the letter which corresponds to the number d as
shown in the look-up table below
d
d 10
2
1
Checksum
A
B
D
E
F
G
H
letter
Part 2
A typical vehicle registration number comes in the format xxx #### y:
x- prefixes
#### – Numerical series (from 1 to 9999, without leading zeroes)
y - Checksum
The checksum letter is caleculated by first converting the letters into numbers, i.e., where A-1 and
Z-26, and numbers to individual digits, potentially giving six individual numbers from the
registration plate.
However, only two letters of the prefix are used in the checksum. For a three-letter prefix, only the
last two letters are used; for a two-letter prefix, both letters are used; for a single letter prefix, the
single letter corresponds to the second position, with the first position as 0.
For numerals less than four digits, additional zeroes are added in front as placeholders, for
example "1" is "0001". SBS 3229 would therefore give 2, 19, 3, 2, 2 and 9 (note that "S" is
discarded); E 12 would give 0, 5, 0, 0, 1 and 2. Ss 108 would be given as 19, 19, 0, 1, 0, 8.
Each individual number is then multiplied by 6 fixed numbers (9, 4, 5, 4, 3, 2). These are added
up, then divided by 19. The remainder corresponds to one of the 19 letters used (A, Z, Y, X, U, T,
S, R, P, M, L, K, J, H, G, E, D, C, B), with "A" corresponding to a remainder of 0, "Z"
corresponding to 1, "Y" corresponding to 2 and so on. In the case of SBS 3229, the final letter
should be a P; for E 23, the final letter should be a H. Ss 11 back letter should be a T. The letters
F, I, N, O, Q, V and W are not used as checksum letters.
Transcribed Image Text:Question 4 Part 1 The checksum letter of a 7-digits number is calculated as such: d = [(i, iz iz i4 is is iz) • (27 65 432)] mod 11 = ( 2in + 7iz + 6is + Si4 + 4is + 3i6 + 2i7 ) mod 11 Where i, is the 1l to last of the 7 digits of the 7-digits number and (2,7,6,5,4,3,2) are the weights. The checksum is a letter which corresponds to the number d as shown in the look-up table below 10 7 6 5 2 4 d Checksum letter 9 8 3 1 A в D E F G J Question 4a Define a function that meets the following specifications. Method name get id checksum Parameter 1. str This str contains the numerical series mentioned in the description above. The length of the str object is 7. Return value 1. str An uppercase letter Detailed deseription From the given string of 7 numbers, computer the number d as described in the section 'Part 1'. Returm the letter which corresponds to the number d as shown in the look-up table below d d 10 2 1 Checksum A B D E F G H letter Part 2 A typical vehicle registration number comes in the format xxx #### y: x- prefixes #### – Numerical series (from 1 to 9999, without leading zeroes) y - Checksum The checksum letter is caleculated by first converting the letters into numbers, i.e., where A-1 and Z-26, and numbers to individual digits, potentially giving six individual numbers from the registration plate. However, only two letters of the prefix are used in the checksum. For a three-letter prefix, only the last two letters are used; for a two-letter prefix, both letters are used; for a single letter prefix, the single letter corresponds to the second position, with the first position as 0. For numerals less than four digits, additional zeroes are added in front as placeholders, for example "1" is "0001". SBS 3229 would therefore give 2, 19, 3, 2, 2 and 9 (note that "S" is discarded); E 12 would give 0, 5, 0, 0, 1 and 2. Ss 108 would be given as 19, 19, 0, 1, 0, 8. Each individual number is then multiplied by 6 fixed numbers (9, 4, 5, 4, 3, 2). These are added up, then divided by 19. The remainder corresponds to one of the 19 letters used (A, Z, Y, X, U, T, S, R, P, M, L, K, J, H, G, E, D, C, B), with "A" corresponding to a remainder of 0, "Z" corresponding to 1, "Y" corresponding to 2 and so on. In the case of SBS 3229, the final letter should be a P; for E 23, the final letter should be a H. Ss 11 back letter should be a T. The letters F, I, N, O, Q, V and W are not used as checksum letters.
Question 4b
Define a function that meets the following specifications.
Function name
get_car_plate_checksum
Parameter
1. str
This str contains the prefixes and numerical series mentioned in the
description above, without the checksum letter.
There is no whitespace in between the prefixes and the numerical series
Return value
1. str
An uppercase letter
Detailed description
Compute and return the checksum from the string parameter. The
computation logic is described in the section titled 'Part 2'.
The checksum is one character in length. The return value is case
insensitive.
You should use the try and except blocks to find out is a character in a
string is an integer or not. The input string may contain 1-3 letters for
prefixes while there can be 1 to 4 digits for the numerical series that
follows.
Transcribed Image Text:Question 4b Define a function that meets the following specifications. Function name get_car_plate_checksum Parameter 1. str This str contains the prefixes and numerical series mentioned in the description above, without the checksum letter. There is no whitespace in between the prefixes and the numerical series Return value 1. str An uppercase letter Detailed description Compute and return the checksum from the string parameter. The computation logic is described in the section titled 'Part 2'. The checksum is one character in length. The return value is case insensitive. You should use the try and except blocks to find out is a character in a string is an integer or not. The input string may contain 1-3 letters for prefixes while there can be 1 to 4 digits for the numerical series that follows.
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Binary numbers
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education