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
OSI is a seven-layered framework used to help define and organize the responsibilities of protocols used for network communicati
sergejj [24]

Answer:

True.

Explanation:

OSI network model is a networking framework that has seven layers that describes the encapsulation and communication of devices in a network. The seven OSI model layers are, application, presentation, session, transport, network, data-link and physical layer.

Each layer in this model describes the protocol datagram unit PDU and identifies several standard and proprietary protocols that can be used in a layer.

A network administrator of engineer can decide to use a protocol based on his choice and the brand of network device used.

8 0
3 years ago
7. Which cipher is based on the clues of the physical factors, rather than the hardware or a software cryptosystem
Stells [14]

Answer:

The concealment cipher.

Explanation:

A concealment cipher also known as null cipher can be defined as an obsolete encryption format that typically involves the mixture of plaintext with non-cipher elements. This ultimately implies that, the plaintext is hidden in another message through encryption.

The concealment cipher is based on the clues of the physical factors, rather than the hardware or a software cryptosystem.

Basically, the concealment cipher is solely dependent on the clues of the physical factors that mainly affects the sender and receiver in a communication system.

7 0
3 years ago
When you make taffy (a pliable candy), you must heat the candy mixture to 270 degrees Fahrenheit.
Sergeeva-Olga [200]

Explanation:

Here's my solution:

import java.util.Scanner; // We start by importing the Scanner, which enables us to put in values

public class Main // our class. Name doesn't really matter here.

{ // Open the brackets of the class.

   

public static void main(String[] args) { // This is our main method. It will run when we run the class.

    System.out.println("Starting Taffy Timer..."); // When we start the timer, we will print out that we do so

 Scanner re = new Scanner(System.in); // Import the scanner into the main method

 int temp; // Define the integer called temperature that the user will put in

 do { /* This is a do while loop -- it will go through the loop, and then it will check the value.

      I decided to use this because we can define temperature without checking the value first.

     What this loop is doing is taking in the temperature, and then checking if it's right. If

     it's a high enough temperature, it will tell the user that it's ready, but if not, it won't. */

     temp = re.nextInt(); // Allow the user to enter in the temperature

     if(temp >= 270) { // if it's high enough, say that it's ready

         System.out.println("Your taffy is ready for the next step!");

         

     }

     else { // if not, don't

          System.out.println("The mixture isn't ready yet.");

         

     }

 }

 while(temp < 270); // This makes sure that if it's ready for the next step, we don't have to continue

}

}

5 0
3 years ago
What is the best definition of the 7x7 rule for maximizing audience comprehension
olganol [36]

The 7x7 Rule states that a PowerPoint slide should have no more than seven lines of text and no more than seven words in each of those lines.

7 0
3 years ago
Print ___________ command is used for adding numbers.​
quester [9]

Answer:

phyton is the answer....

5 0
3 years ago
Other questions:
  • Monica needs a printer to use at home. She wants fine-quality prints at an affordable cost. Which printer will help her achieve
    9·1 answer
  • To have the most impact when using email, you should structure your messages so that
    5·1 answer
  • A method that receives a two-dimensional array uses two ____ pairs following the data type in the parameter list of the method h
    11·1 answer
  • What does the % find?
    9·2 answers
  • Which of the following are examples of jobs in the allied health profession? select all that apply.
    8·1 answer
  • What is the primary means by which attackers infect computers with these attacks? How do these attacks commonly occur?
    8·1 answer
  • You are given a 5-letter word (for example, abcde). Write a C-Program which outputs all possible unique 5 letter permutations of
    13·1 answer
  • In which of the following stages of the development process is a team MOST likely to interview a potential user of an app?
    6·1 answer
  • Office 365 ProPlus can be deployed to your enterprise. When doing so, which tool enables you to choose the language, hardware ar
    5·1 answer
  • Kinda strange, and im good
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!