Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

how do I do this using python? Define the get_triples_dict() function which is passed a string of text as a parameter. The function first converts

image text in transcribed

image text in transcribed

how do I do this using python?

Define the get_triples_dict() function which is passed a string of text as a parameter. The function first converts the parameter string to lower case and then retuns a dictionary with keys which are all the unique consecutive three alphabetic characters from the text, and the corresponding values are the number of times the three consecutive alphabetic characters appear in the text. Use the isalpha) method to check if a character is alphabetic or not. The dictionary should only contain entries which occur more than once. After your dictionary has been created and populated, you need to remove any key-value pairs which have a corresponding value of 1. For example, if the text is "Super, duper" the algorithm proceeds as follows Character 's:String is "s", Dictionary is t Character u':String is "su", Dictionary is Character 'p':String is "sup", change string to "up", 'sup": 1) Character'e String is "upe", change string to "pe", Dictionary is f sup 1 upe: 1 CharacterrString is "per", change string to "er", Dictionary is 'sup 1, "upe 1 per'1) Character ',': String is "er", Dictionary is {'sup": 1, upe': 1, 'per': 1} CharacterString is " Dictionary is sup1 upe1, 'per1) Character'd'String is "erd", change string to "rd", Dictionary is 'sup': 1 upe'1 per' 1, erd1) Character'String is "rdu", change string to "du", Dictionary is Character 'p': String is "dup", change string to "up", Dictionary is Character'e String is "upe", change string to "pe", Dictionary is Character'r':String is "per", change string to "er", Dictionary is Remove all entries with a value of 1: upe 2, "per': 2 'sup': 1 upe1 per': 1, erd 1, "rdu': 1 'sup: 1, "upe'1 per' 1, 'erd 1, 'rdu: dup 1) 'sup: 1, "upe'2, 'per' 1, 'erd 1, 'rdu: dup 1) 'sup: 1, "upe'2, 'per' 2, 'erd 1, 'rdu: dup 1) For example, executing the following code

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

Database Processing Fundamentals Design

Authors: Marion Donnie Dutton Don F. Seaman

14th Edition Globel Edition

1292107634, 978-1292107639

More Books

Students also viewed these Databases questions

Question

How to find if any no. is divisble by 4 or not ?

Answered: 1 week ago

Question

Explain the Pascals Law ?

Answered: 1 week ago

Question

What are the objectives of performance appraisal ?

Answered: 1 week ago