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]
3 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]3 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
What is a disruptive technology? Give an example of an aspect of society that has been impacted by technological change.
Ray Of Light [21]

Answer:

A disruptive technology sweeps away the systems or habits it replaces because it has attributes that are recognizably superior. Recent disruptive technology examples include e-commerce, online news sites, ride-sharing apps, and GPS systems.

4 0
2 years ago
Intro to cs 3.7 edhesive g=float(input("Enter your English test grade:")) if(g<=64): print("F") if (g>=65 and g<69): pr
qwelly [4]

Answer:

The correct code for this question:

g=float(input("Enter your English test grade:")) #take input from user.

#check conditions

if (g>=100 and g<=90):

print ("A")

#g greater then equal to 100 and less then equal to 90.

if (g>=89 and g<=80):

print("B")

#g greater then equal to 89 and less then equal to 80.

if (g>=79 and g<=70):

print("C")

#g greater then equal to 79 and less then equal to 70.

if (g>=69 and g<=65):

print("D")

#g greater then equal to 69 and less then equal to 69.

if(g<=64):

print("F")

#g less then equal to 64.

else:

print ("Not a grade")

#not a grade or fail.

Explanation:

In this program, we use to take a value from the user and check the value from the various conditions. To check all the condition we use if-else statement and AND operator that check to the range to together.

If -else is a conditional operator. In that, If block is used to check the true part and else part takes false value, and AND is a logical operator that check the two range together  

5 0
3 years ago
Whats the correct answer
dem82 [27]
Line 2 or line 4 sorry if I’m wrong
7 0
3 years ago
Read 2 more answers
Hi there! I am writing a code to make a square using a drone, however I’m having trouble doing so. The website that I’m writing
Jlenok [28]

Answer:

i might

Explanation:

3 0
2 years ago
What are work incidents/situations or ethical problem?<br>​
777dan777 [17]

5 Common Ethical Issues in the Workplace

Unethical Leadership.

Toxic Workplace Culture.

Discrimination and Harassment.

Unrealistic and Conflicting Goals.

Questionable Use of Company Technology.

7 0
2 years ago
Read 2 more answers
Other questions:
  • 14. Which commercial RDBMS product was the first to hit the market and is the biggest?
    15·1 answer
  • What effects will the different types of lighting produce on mountains?
    15·1 answer
  • Assume you have a project with seven activities labeled A-G (following). Derive the earliest completion time (or early finish-EF
    15·1 answer
  • In regard to protective actions for explosive devices, the area where the blast originates is referred to as ___________ perimet
    8·1 answer
  • The countryside presents
    11·1 answer
  • Use the drop-down menus to complete each sentence about the layers of the atmosphere.
    14·2 answers
  • )In a graph represented by adjacency matrix u can find all the neighbours of a given vertices in ____Operations
    6·1 answer
  • Describe how the presence or absence of balance can affect a visitor’s perceptions of a Web page.
    7·1 answer
  • Construct sequence using a specified number of integers within a range. The sequence must be strictly increasing at first and th
    6·1 answer
  • Kylee needs to ensure that if a particular client sends her an email while she is on vacation, the email is forwarded to a
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!