Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

=+65-1 Explain how we draw the line between normality and disorder.

Answered: 1 week ago

Question

Write 500 words explaining residual income

Answered: 1 week ago