Question: Please answer in Python (no imports, no list comprehensions) Given a file with an encoded message, parse through it line by line and return a
Please answer in Python (no imports, no list comprehensions)
Given a file with an encoded message, parse through it line by line and return a decoded version of the file in one string, with each decoded message in a new line. Dont remove the extra empty line (last line) from the output string.
while decoding, ignore: all exclamation points (!), question marks (?), semicolons (;), dollar signs ($) and any whitespaces.
For example:
if input = "2!03!!!4 $el!;k?in ??s!tre!$$et" ; output = "2034 elkin street"
def decode(file): """ >>> print(decode('files/encoded_1.txt').strip()) stevie wonder 2 #4 b#l3o()% m@^^^& ave Ffsdf812*2&@*1 Lafayette Street 32'1 fulleH##r "dr^i~v@e @&*(@@&&&@#& 8/09 1-2 >>> print(decode('files/encoded_3.txt').strip())
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
