Question: A company uses codes to represent its products, for example ABC 2 4 7 5 A 5 R - 1 4 . Valid codes must

A company uses codes to represent its products, for example ABC2475A5R-14. Valid codes must have:
At least 10 characters (some codes have more than 10 characters)
Positions 4 through 7 must be digits (and represents the country in which the product will be sold)
The character in the 10 th position must be a capital letter and represents the security level of the product.
Write a Python program that will read 10 product codes from a text file (Codes.txt - attached below). Determine if each conforms to the rules listed above:
If it does conform, print a heading: Valid Code(s) are: and list the codes that are valid. If it does not conform, print a heading: Invalid Code(s) are: and list the
codes that area invalid. Be sure to test all possible combinations.
Further, if the code is valid, due to new government security laws, products with a security level of R(restricted) are no longer to be sold in countries with a
country code of 2000 or higher. Output a heading: Invalid Restricted Code(s) are: and list the codes that are invalid in case you encounter any products that
violate these new laws. XYZ2755R-14
RST1234A6A-12
UVW24a6R7R-13
PQR3999F85-11
STI1281J9A-04
FOR2561T4R-54
BID2075U3R-55
AGA1475P1B01
JBT2175E5X-04
KAM1145X2R-05
 A company uses codes to represent its products, for example ABC2475A5R-14.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!