Encode string into its original uncoded form
Hi programmers. Iām relatively new to python and Iām doing a course in my university to learn it. I have to following problem. I have to encode the following type of strings: H-VCG EIEOS L--D- LLEI- OONN- It should be: āHELLO I LOVE ENCODINGSā I already have the following function: def decode(input_string): mylist = [ ] string = "" mylist.append(input_string[0]) for i in range(len(input_string)): if(input_string[i] == ' '): mylist.append(input_string[i+1]) for i in mylist: string += i return string THIS RETURNS ONLY THE STRING āHELLOā THE FOLLOWING STRINGS SHOULD ALSO WORK WITH THIS FUNCTION: assert_equal(decode("H-VCG EIEOS L--D- LLEI- OONN-"), 'HELLO I LOVE ENCODINGSā) assert_equal(decode("NHRHA OA-IG BLRSE OLE-- D-AM- YEDE- -V-S- SETS-"), 'NOBODY SHALL EVER READ THIS MESSAGE') Thank you for any solutions or tips!!