Question: Error Correcting Postal Codes - part 1 Given the following input, write the code so that it will read in the postal codes, then determine

Error Correcting Postal Codes - part 1 Given the following input, write the code so that it will read in the postal codes, then determine if the postal code is valid or invalid. 1 11000 00011 01010 01100 01100 00011 10100 10010 00011 10100 00110 00011 1 1 11000 00011 01010 01001 11000 10100 01010 01100 01010 01010 00011 10100 1 1 01100 01010 01010 00101 10000 10001 00110 01100 00011 00110 00011 00110 1 1 01001 10001 10100 10010 11000 11001 00011 11000 01010 00011 01010 00110 1 1 00101 00110 10100 01100 11000 00011 10001 11000 00110 00011 10100 10100 1 1 10001 01001 01001 01010 10001 01001 01001 10001 00101 01100 01100 01001 1 Note row 3 column 6 -- 10000 -- it should be 10010. Sample logic for the program open the file for reading loop to read 6 lines loop to pick off 12 groups Read in 1 line and print it loop determine if one of the groups are valid or invalid end loop if the group valid then print 'valid' else print 'invalid' end loop end loop close the file Sample output: 1 11000 00011 01010 01100 01100 00011 10100 10010 00011 10100 00110 00011 1 valid 1 11000 00011 01010 01001 11000 10100 01010 01100 01010 01010 00011 10100 1 valid 1 01100 01010 01010 00101 10000 10001 00110 01100 00011 00110 00011 00110 1 invalid 1 01001 10001 10100 10010 11000 11001 00011 11000 01010 00011 01010 00110 1 invalid 1 00101 00110 10100 01100 11000 00011 10001 11000 00110 00011 10100 10100 1 valid 1 10001 01001 01001 01010 10001 01001 01001 10001 00101 01100 01100 01001 1 valid 

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!