Question: Please answer in Python. I'm using the code in the image but keep getting an error. 1. How many Sentences? LL Given an array of

Please answer in Python. I'm using the code in the image but keep getting an error.
Please answer in Python. I'm using the code in the image but
keep getting an error. 1. How many Sentences? LL Given an array
of words and an array of sentences, determine which words are anagrams
of each other. Calculate how many sentences can be created by replacing
any word with one of its anagrams. 1 Example wordSet = ['listen!
silent! it vis? sentence = "listen it is silent N 2 Determine
that listen is an anagram of silent. Those two words can be
replaced with their anagrams. The four sentences that can be created are:

1. How many Sentences? LL Given an array of words and an array of sentences, determine which words are anagrams of each other. Calculate how many sentences can be created by replacing any word with one of its anagrams. 1 Example wordSet = ['listen! silent! it vis? sentence = "listen it is silent N 2 Determine that listen is an anagram of silent. Those two words can be replaced with their anagrams. The four sentences that can be created are: ::::::: listen it is silent listen it is listen silent it is silent silent it is listen Function Description Complete the countSentences function in the editor below. countSentences has the following parameters: string wordSet[n]: an array of strings string sentences[m]: an array of strings Returns: intl: an array of mintegers that denote the int[]: an array of mintegers that denote the number of sentences that can be formed from each sentence ALL Constraints 01: count=count+dict[s] arr.append(count) return arr word=0 sentences=0 n=int(input()) for i in range(n): str=input() word.append(str) m=int(input()) for i in range (m): str=input() sentences.append(str) arr=count Sentences (word, sentences) for i in arr: print (i) (word, sentences) 52 for i in arr: print (1) 53 54 55 Vif -_name__ __main__': fptr = open(os.environ['OUTPUT_PATH'), 'w') 56 57 58 wordSet_count = int(input().strip) 59 60 wordSet - 0) for : 61 62 63 64 65 in range (wordSet_count): wordset_item = input) wordset.append(wordset_item) 66 67 sentences_count = int(input().strip) Sentences = [] 68 69 70 for in range (sentences_count): sentences_item=input() sentences.append(sentences_item) I 71 72 73 74 75 76 result = countSentences (wordSet, sentences) fptr.write(' '.join(map(str, result))) fptr.write(' ') TB 79 Be fptr.close() Test Results Custom Input G Search or type URL a Python 3 Autocomplete Ready stranput) 45 word.append(str 46 int(input()) 47 for 1 in range(a): strainput) 49 sentences.append(str) 50 51 arr count Sentences (word, sentences) for 1 in arri 53 print (1) 54 55 vif name.* main 50 fptropen (os.environ['OUTPUT_PATH'), 'w) 57 58 wordset.count = int(input().strip) Test Results Custom Input in Code Run Tests Compiled successfully Run all test cases Compiler Message Runtine Error Errore Traceback (most recent call last): File "/tmp/submission/20220121/01/23/hackerrank-776626901002ddfos/code/satution.py", line sa facute werdset count int(input().strips EOFError or when reading a line put istine MacBook Pio R Search or type URL & 0 7 9 00 8 { 0 [ Y U 47 for 1 in range(n): 48 strainput) 49 sentences.append(str) 50 51 arracountsentences (word, sentences) 52 for i in arr: 53 print (1) 54 55 vif name.**'main' 56 fptr open(os.environ('OUTPUT_PATH'), 'w) 57 55 wordSet count - int (input().strip()) Test Results Custom Input un Code Compiled successfully Run all test cases + in the act tact tabs in Your Output out - no response on stdout - Expected but De MacBook Pro G Search or type URL ) & 9 6 0 8 N 7 I U O P 7 Y T

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!