Question: Objective This assignment is designed to provide you with practice using selection statements to solve an encoding problem. Description Your friend Maverick recently landed a

 Objective This assignment is designed to provide you with practice using
selection statements to solve an encoding problem. Description Your friend Maverick recently
landed a lucrative engineering co-op work term in an oil-rich country. Meanwhile,
you chose to make a modest salary as a co-op intern with
the Canadian Security intelligence Service (CSIS). A week after arriving in the

Objective This assignment is designed to provide you with practice using selection statements to solve an encoding problem. Description Your friend Maverick recently landed a lucrative engineering co-op work term in an oil-rich country. Meanwhile, you chose to make a modest salary as a co-op intern with the Canadian Security intelligence Service (CSIS). A week after arriving in the foreign country, Maverick is kidnapped by rebels opposed to oil exploration. He is held captive in a small village within rebel territory. Luckily, a group of disenchanted rebels are willing to smuggle Maverick to one of seven rendezvous points: - the village bridge - the village library - river crossing - nearby airport - bus terminal - hospital - railway station where an allied helicopter will pick them up and fly them to safety. For the plan to work, the friendly rebels need to know two pieces of information: - the day of the rendezvous - the rendezvous point CSIS has devised a nine-digit code to carry this information to the friendly rebels. When the time is ripe, cSIS will insert a coded message into the online newspaper of the oil-rich country, as a number on the front page. The rebeis have internet access via satellite links and follow the news. While it is helpful (as a decoy strategy) that the newspaper has other numbers on the front page, e.g. in real adverts, it is vital that the rebel insiders can detect and decode the secret message. cSIS has found a way to smuggle a decoder to the friendly rebels. You are asked to program the decoder in Python. The safety of your friend Maverick depends on your ability to program the decoder correctly. Version 0: Getting Started Download and unzip the files in the VoGetStarted.zip file into your Current Folder. Open the lab2vo.py file in the Editor Window and inspect it before running it. The program will prompt the user to enter a code to break. Try the following input Test Case \#1 - 123456789 The output for the test case in the command console should match the image in the CommandOutputvo.pdf file that was unzipped. For further testing, go ahead and try other combinations. Version 1: Partial Decoder 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. 2222222222 , 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 Rule 3. Multiply the 3rd digit by the 2nst digit, then subtract the 1It digit. Display this number to the command window (Displaying the text 'day zisoptional) Rule 4. Calculate the value of the 3re digit to the power of the 22 digit. - If the value is divisible by 3 , then subtract the 6 th digit - 5 th digit - If the value is not divisible by 3 , then subtract the 5 th digit - 6th digit Display this number to the command console. (Displaying the text 'place = ' is optional) is of Test Case 112345678 Test Case 2 - 123456788 Test Case 3123456789 Test Case 4732456789 The output for the test cases in the command window should match the images in the CommandOutputV1.pdf file that was unzipped. For further testing, go ahead and try other combinations. Test Case 1-12345678 Lab2 - Version 1 Please enter a code to break: 12345678 Decoy message: Not a nine-digit number. Test Case 2 - 123456788 Lab2 - Version 1 Please enter a code to break: 123456788 Decoy message: Sum is Even. Test Case 3123456789 Lab2 - Version 1 Please enter a code to break: 123456789 day =5 place =1 Test Case 4732456789 Lab2 - Version 1 Please enter a code to break: 732456789 day =1 place =1 \# Electrical and compucer Engrneerung \# A11 rights peserved. * Student mame: - Student ccit: - Othens: * To avoid plagiarion, Llat the names of persans, Verghon o author (as) A exciucied, whose code, words, Hdels, of data you uged. To guard \# cheating, 1 ist the nameg of persons, excluding che Bmpmp 100 lab * instructot and TAs, who gave you comporational as riateance. 1. After each fame, including your own nane, entez fn parentheses an \# estimate of the person's contitibutiong in percent. Wyithout these * numbers, adaing to 100\%, follow-up questions thay he agked. \# F For anonymous sources, enter pseudonyms in uppergage, elig. sAuRON, * followed by percentages as above. Fmali a 1 unk to of a copy pf the \# sounce to the lab instructor before the asaigmmenting iue. import numpy as np print ('Version 1') f. -..-. - Students write/modify their code below here code = input ('Please enter a code to break: ') code = np. array (1ist (code), dtype=nint) print ("The code entered is 9 " \& code)

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!