Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please answer in Python. Problem 3 A function stringList which converts a string to a list of strings is given below. Include this function in

Please answer in Python.

image text in transcribed

Problem 3 A function stringList which converts a string to a list of strings is given below. Include this function in your code file. def atringtist { str 1}: return str1. split \{\} stringList ("Hello this is test run") ['Hello', 'this', 'is', 'test', 'run'] Your job is to encode a given message. Write a recursive function encodeM which takes a list of strings and converts it to an encoded message. Note: you can make use of the encode function, encode works on a single string and encodeM encodes all strings in the given list of strings. encodeM(['This', 'is', 'a', 'test', 'run']) ['Ymnx', 'nx', 'f', 'yjxy', 'wzs'] Write a recursive function decodeM, which uses a function decode to decode the list of strings. decodeM (['Ymnx', 'nx', 'f', 'Yjxy', 'wzs']) ['This', 'is', 'a', 'test', 'run'] The function main given below should be included in your program and once remove Pun, encode, enodeM, decode and decodeM have been written this function will give the following output. main ("COMP1126!! is, a lot of:;. fun?") Given atring COMP1126!! is a lot of:;. fun? Punctuation removed COMP1126 is a lot of fun List Encoded ['HTRU667;', 'nx', ' f ', 'qty', 'tk', 'kzs'] List Decoded ['COMP1126', 'is', 'a', 'lot', 'of', 'fun'I Encoded Message HTRU667; nx f qty tk kzs def main (s): slst=removePun (s) elist = encodeM (stringIist (slst) ) dist = decodeM (eLiat) print "Given string => ", ") print ("Punctuation removed =>n, Elst) print("Iist Encoded =>", eList] print "List Decoded => ", dList? print ("Encoded Message =>", ', join(eLiat))

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David M. Kroenke, David Auer

11th Edition

B003Y7CIBU, 978-0132302678

More Books

Students also viewed these Databases questions

Question

LO5 Illustrate the steps in developing a base pay system.

Answered: 1 week ago

Question

LO3 Outline strategic compensation decisions.

Answered: 1 week ago