Question: Can I know where I made a mistake? This code should work for all text. The code is in python. Problem program.py constants.py Import var1ous

Can I know where I made a mistake? This code should work for all text. The code is in python.Can I know where I made a mistake? This code should work

Problem program.py constants.py Import var1ous text constants from . constants from constants import Create a function rr eq t hr eshold(t ext , n) which returns the number of characters whose frequency in a given piece of text is strictly greater than a threshold value n (a non negative integer 3 tallyth 4- der freq threshold(LexL, n): The examples below assume that the first paragraph from Moby Dick has been read into the variahle NORY, which we achieve by importing variables from the file constants.py. Note that you are welcome to re-use code from earlier problems relating to this text. tor text In MOBY: if text in tally: tally[text] 1 10 tallyltext - 1 Here are some cxamples of how your function should behave: for a 1n tally: if float (tally[al) float(n): int(freq-threshold (MOBY, 50)) r int (freq threshold (MOBY, 100)) 10 12 13 14 return b PEP8 The provided import command will lead to a number of warnings from PEP8, which you do not need to resolve, although it is worth looking over the PEP8 output and the content of constants.py to understand the nature of the problem. In general, PEP8 is correct in discouraging the use of the trom LIBRARY 1nport statement (why?. Submissions Output Line S: ES81 1ine too long (88 79 char acters) program-py LIne 2: 403 'tron constants Import used; unable to detect undet! ned nanes Line 6: F405 'MOBY' may be undefined, or defined from star imports: constants Testing the first example from the problem. VTesting the second example from the problem. VTestingaeyhigh threshold over adiffet text X Testing a threshold of zero (ove a dife text). Your furnction did not return the correct value. Your function returned 36 when it should have returnedd 37

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!