Question: Download and unzip the files in the V 1 PartialDecoder.zip file into your Current Folder. The decoder will implement 4 different rules to determine if

Download and unzip the files in the V1PartialDecoder.zip file into your Current Folder. The decoder will implement 4 different rules to determine if the code is correct or not. In version 1, you will implement Rules 1 and 2 and the partial implementation of Rule 3 and 4. Please use the provide
lab2V1.py file to write your program.
NOTE. Only Rules 1 and 2 may display an invalid message. When an invalid message is encountered, do not proceed with the remaining Rule checks. For example, if Rule 1 is invalid, do not check Rules 2,3 or 4.
Rule 1. A valid code must be a 9-digit number.
e.g.123456789, message MAY be valid
e.g.12345678, message invalid
e.g.1234567890, message invalid
If the code entered is invalid, display the message 'Decoy Message: Not a nine-digit number.' to the command window and terminate the program
Rule 2. The code must pass the odd-even "truth" test. (Do not use any loops to do this)
If the sum of the digits is even, the message is invalid.
e.g.222222222, sum =2+2+2+2+2+2+2+2+2=18, message invalid
If the sum of the digits is odd, the message MAY be valid.
e.g.222222223, sum =2+2+2+2+2+2+2+2+3=19, message may be valid
If the code entered is invalid, display the message 'Decoy Message: Sum is even.' to the command window and terminate the program
 Download and unzip the files in the V1PartialDecoder.zip file into your

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!