Question: Mastery Level Write a function symmetry ( inpath , outpath ) to read the left half of an ASCII image from the input file inpath
Mastery Level
Write a function symmetryinpath outpath to
read the left half of an ASCII image from the input file
inpath linebyline, repair the image, and write the
result to the output file outpath
Do not duplicate the last character on each line the
"spine" of the butterfly
Use the basic tryexcept statement to catch a
possible exception:
If success then return True, otherwise display the
error message and return False.
All lines in the file should have the same length, but do
not rely on this.
Test it and if it's not the case, then display a warning
"WARNING: Lines do not have the same
length." and return False.
Expected output
Do not change the main program. Expected output is shown on the right.
Hint: Study the image carefully. You will find that besides reversing each line, you also need to swap the parentheses
and and the forward and backward slashes. The backward slash is a special character, therefore you need to
use for it
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
