Question: in python3, complete the function def compute(secretmapping, wordlist): 8. Secret Homonyms A secret language is a derived language in which every English alphabet is replaced

in python3, complete the function def compute(secretmapping, wordlist):  in python3, complete the function def compute(secretmapping, wordlist): 8. Secret Homonyms
A secret language is a derived language in which every English alphabet
is replaced by anot For example, there could be some language in
which a maps to "" b maps to ... cmaps to d

8. Secret Homonyms A secret language is a derived language in which every English alphabet is replaced by anot For example, there could be some language in which a maps to "" b maps to ... cmaps to d maps to Any word in a secret language can be written as a concatenation of the secret code of each can be written as "...". Let this new string be called a secret code of the string "bad". Given a list of words, return the number of unique secret codes that can be found in our Function Description: Input: The function compute_distinct_homonyms takes two arguments. The arguments ar 1. secret_mapping: A list containing 26 strings in which each string maps to its respective 2. word_list: List of words we wish to transform into the secret language. Output: Integer showing the number of distinct strings when the words are mapped to ou Example: Input secret_mapping = ["b", "b", "d", "d", "f","f", "f", "h", "}", "j"T, T, "n","n". "p". "x", "z", "2"] word_list = ["food", "good", "zap", "yap"] Output: 2 Explanation: in the above question, Any word in a secret language can be written as can be written as "..."Let this new string be called a secret code of the string "bad". Given a list of words, return the number of unique secret codes that can be found in our Function Description: Input: The function compute_distinct_homonyms takes two arguments. The arguments an 1. secret_mapping: A list containing 26 strings in which each string maps to its respective 2. word_list: List of words we wish to transform into the secret language. Output: Integer showing the number of distinct strings when the words are mapped to ou Example: Input secret_mapping = ["b", "b", "d", "d", "T","f", "Y","h". "T". ")", "1", "1", "n","n": "p":"p""r". "Y"," "x", "z", "z") word_list = ["food", "good", "zap", "yap"] Output: 2 Explanation: In the above question. a maps to b. b maps to b. c maps to d and so on. In our new language, food means fppd good means fppd means zbp means zbp Thus, there are 2 distinct words when the original words are mapped to our secret langu ecret language can be written as a concatenation of the secret code of each letter eg "bad" ns...... Let this new string be called a secret code of the string "bad". words, return the number of unique secret codes that can be found in our list. ription: stion compute_distinct_homonyms takes two arguments. The arguments are: Ing: A list containing 26 strings in which each string maps to its respective character in a-z. tof words we wish to transform into the secret language. er showing the number of distinct strings when the words are mapped to our secret language. ing = ["b", "b", "d", "d", "f", "f", "T", "","J". "T", """n","n", "p":"p":"",""".v.v. food", "good". "zap", "yap"] 1: e question and so on. language, as fppd sfppd os zbp Thn at anuage 12 13 def compute_distinct_homonyms (secret_mapping, wordt): 1 if name _main': fptr = open(os.environ['OUTPUT_PATH'), *w*) secret_mapping_count int(input().strip) secret_mapping = [] for in range (secret_mapping_count): secret_mapping_item input secret_mapping.append(secret_mapping_item) word_list_count = int(input().strip) 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 word_list = [] for in range (word_list_count): word_list_item = input() word_list.append(word_list_item) res = compute_distinct_homonyms (secret_mapping, word_list) fptr.write(str(res) + ' ') fptr.close()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!