1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Zielflug [23.3K]
4 years ago
13

Write a program that reads whitespace delimited strings (words) and an integer (freq). Then, the program outputs the strings fro

m words that have a frequency equal to freq in a case insensitive manner. Your specific task is to write a function words Frequency(words, freq), which will return a list of strings (in the order in which they appear in the original list) that have a frequency same as the function parameter freq. The parameter words to the function words Frequency(words, freq) should be a list data structure. If two strings in the list words contain the same sequence of characters but are different case, they are considered the same. For example, we will consider the strings UCONN and uconn to be the same.
Computers and Technology
1 answer:
Lesechka [4]4 years ago
3 0

Answer:

See explaination for the code

Explanation:

def wordsOfFrequency(words, freq):

d = {}

res = []

for i in range(len(words)):

if(words[i].lower() in d):

d[words[i].lower()] = d[words[i].lower()] + 1

else:

d[words[i].lower()] = 1

for word in words:

if d[word.lower()]==freq:

res.append(word)

return res

Note:

First a dictionary is created to keep the count of the lowercase form of each word.

Then, using another for loop, each word count is matched with the freq, if it matches, the word is appended to the result list res.

Finally the res list is appended.

You might be interested in
The small, touch-sensitive area at the base of the keyboard on a notebook computer is known as a ________.
USPshnik [31]
Trackpad.

(Sheep sheep mr sheep meep)
8 0
4 years ago
Read 2 more answers
You can use _____ to track the state of each user in the application.
anastassius [24]

Answer:

session state

Explanation:

Session state in the context of NET is a method keep track of a user session. Session states allow a developer to store data about a user as he or she navigates through ASP.NET web pages.

3 0
3 years ago
Slide transition can be defined as ____ of one slide after another​
UkoKoshka [18]

Answer:

visual effect

Explanation:

A slide transition is the visual effect that occurs when you move from one slide to the next during a presentation. You can control the speed, add sound, and customize the look of transition effects.

6 0
3 years ago
Insert the missing code in the following code fragment. This fragment is intended to read an input file named dataIn.txt and wri
olasank [31]

Answer:

new Scanner(inputFile)

Explanation:

In Java when inputting a file using Scanner class. A Scanner breaks the input into tokens with the help of delimiting patterns, by default which matches the whitespaces and then the tokens that are received may be converted into values of different types by suing different next methods.

6 0
3 years ago
Mooreis Law applies only to hardware.<br> true<br> false
Semmy [17]

Answer:

Moore’s Law originally predicted that the number of transistors in a processor would double every year (he later revised it to every two years). The law applies to integrated circuits (a piece of semiconducting material with several circuits on it) and the technologies that use them.

Explanation:

Moore's Law refers to Gordon Moore's perception that the number of transistors on a microchip doubles every two years, though the cost of computers is halved. Moore's Law states that we can expect the speed and capability of our computers to increase every couple of years, and we will pay less for them. Another tenet of Moore's Law asserts that this growth is exponential

5 0
2 years ago
Other questions:
  • Which string method counts the number of characters in a string?
    5·1 answer
  • I am confused about joins in sql.
    8·2 answers
  • You are preparing to program a replacement system board, but the "system is booting in mpm mode" message is not displayed. what
    10·2 answers
  • Where should Nolan go to change the font size of his message before printing it? A.the Paper tab in the Define Styles dialog box
    14·1 answer
  • To read visual and audio text means
    11·1 answer
  • Change the shape fill color to Dark Red. It is the first option in the Standard Colors section of the color palette.
    13·1 answer
  • HELP 15 POINTS
    12·2 answers
  • Image-editing software is used to _____.
    15·2 answers
  • Help fast plzzzzzzzzzzzz ​
    10·2 answers
  • Ashley has many interests. She likes to read, listen to music, and play soccer with her friends. But her favorite thing to do is
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!