Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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, 5031

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

Step: 3

blur-text-image

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

IBM Db2 11 1 Certification Guide Explore Techniques To Master Database Programming And Administration Tasks In IBM Db2

Authors: Mohankumar Saraswatipura ,Robert Collins

1st Edition

1788626915, 978-1788626910

More Books

Students also viewed these Databases questions