You are given the following functions (assume imports have been properly made): def make_dictionary(f: TextIO) -> Dict[Tuple[str], list[str]]: *** Return a dictionary where the keys are tuples of length SOME LENGTH containing words in and the value for a key is the list of words that were found to follow the key in . # code for make_dictionary hidden def mimic_text(word_dict: Dict[Tuple[str], list[str]], num_words: int) -> str: Based on the word patterns in , return a string that mimics that text, and has words. # code for mimic_text hidden Let's assume that the following lines of code are executed (free from any errors): d = make_dictionary(open("my_text.txt")) m- mimic_text(d, 100) What can we infer if the fourth key/value pair in our dictionary is: , 'Pineapple", "pizza,, "yuck!"): ['Why?11? Note: we are using Python 3.9 so "dictionaries preserve insertion order" (see documentation e). Select all correct answers that apply. O mimic_text returns None if my_text.txt is empty O The first key/value pair is (", ", ", "Pineapple'): ['pizza;] O The fifth key inserted in the dictionary is ('Pineapple', 'pizza, 'yuck!", "Why?!") O Nothing can be inferred because we love pineapples in CSC108. O SOME LENGTH = 3 O SOME LENGTH = 4 O make_dictionary returns None if my_text.txt is empty

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
You are given the following functions (assume imports have been properly made):
def make_dictionary(f: TextI0) -> Dict[Tuple[str], list[str]]:
*" Return a dictionary where the keys are tuples of length SOME LENGTH
containing words in <f> and the value for a key is the
list of words that were found to follow the key in <f>,
# code for make_dictionary hidden
def mimic_text(word_dict: Dict[Tuple[str], list[str]], num_words: int) -> str:
" Based on the word patterns in <word_dict>, return a string that mimics
that text, and has <num_words> words.
# code for mimic_text hidden
Let's assume that the following lines of code are executed (free from any errors):
d = make_dictionary(open("my_text.txt"))
m - mimic_text(d, 100)
What can we infer if the fourth key/value pair in our dictionary is: (", 'Pineapple', "pizza,, "yuck! ): ['Why?!1? Note: we are using Python 3.9 so "dictionaries
preserve insertion order" (see documentation e). Select all correct answers that apply.
O mimic_text returns None if my_text.txt is empty
O The first key/value pair is (", ",". 'Pineapple'): ['pizza;)
O The fifth key inserted in the dictionary is ('Pineapple', 'pizza, 'yuck!", "Why?!")
O Nothing can be inferred because we love pineapples in CSC108.
O SOME LENGTH = 3
O SOME LENGTH = 4
O make_dictionary returns None if my_text.txt is empty
Transcribed Image Text:You are given the following functions (assume imports have been properly made): def make_dictionary(f: TextI0) -> Dict[Tuple[str], list[str]]: *" Return a dictionary where the keys are tuples of length SOME LENGTH containing words in <f> and the value for a key is the list of words that were found to follow the key in <f>, # code for make_dictionary hidden def mimic_text(word_dict: Dict[Tuple[str], list[str]], num_words: int) -> str: " Based on the word patterns in <word_dict>, return a string that mimics that text, and has <num_words> words. # code for mimic_text hidden Let's assume that the following lines of code are executed (free from any errors): d = make_dictionary(open("my_text.txt")) m - mimic_text(d, 100) What can we infer if the fourth key/value pair in our dictionary is: (", 'Pineapple', "pizza,, "yuck! ): ['Why?!1? Note: we are using Python 3.9 so "dictionaries preserve insertion order" (see documentation e). Select all correct answers that apply. O mimic_text returns None if my_text.txt is empty O The first key/value pair is (", ",". 'Pineapple'): ['pizza;) O The fifth key inserted in the dictionary is ('Pineapple', 'pizza, 'yuck!", "Why?!") O Nothing can be inferred because we love pineapples in CSC108. O SOME LENGTH = 3 O SOME LENGTH = 4 O make_dictionary returns None if my_text.txt is empty
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY