Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This is Python Help, please Exercise 2 def encrypt (phrase): Input: a string that is a sentence or phrase Result: returns a 2 dimensional list
This is Python
Help, please
Exercise 2 def encrypt (phrase): Input: a string that is a sentence or phrase Result: returns a 2 dimensional list of ASCII codes Details: The function encrypts the provided sentence by converting each word, into a list which contains the ASCII code values for the letters of the word. All the resulting lists are themselves added to an outer list, resulting in a 2 dimensional list. For example, the phrase "too many cats" is converted to [[116, 111, 111). [109, 97, 110, 121). 199, 97, 116, 115). Remember that ord(T) is 116. Example output: >>> encrypt ('When will the sun come back'> [[ 87, 104, 101, 110, 119, 105, 108, 108), 116, 104, 101), [115, 117, 1101. 99, 111, 109, 102). [ 98, 97, 99, 10711 >>> encrypt('Is there room for 1 more? 173, 115, 1116, 104, 101, 114, 101). [114, 111, 111, 109, ( 102, 111, 114, (49). 109, 111, 114, 101, 6311 >>> encrypt("Number test: 73, 115, 104, 22') [[ 78, 117, 109, 98, 101, 114). (116, 101, 115, 116, 58). 55, 51, 44, 49, 49, 53, 44, 49, 48, 52, 44. [50, 5031Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started