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
Illusion [34]
2 years ago
10

Write a Python program called wdcount.py which uses a dictionary to count the number of occurrences of each word (ignoring case)

in a pure text file encoding UTF-8. Note that the input text file name is given from the command line. To make it simple, you may assume that the file does not contain any punctuation characters. Your program should print each word along with its number of occurrences in descending order. That is the most frequent word should be printed first.
Computers and Technology
1 answer:
Art [367]2 years ago
5 0

The program is an illustration of loops.

<h3>What are loops?</h3>

Loops are program statements used to perform repetition

<h3>The wordcount.py program</h3>

The program written in Python, where comments are used to explain each line is as follows

# This opens the file in read mode

text = open("myFile.txt", "r")

# This creates an empty dictionary

d = dict()

#This iterates through the text

for line in text:

# This splits the line into words, after removing leading & trailing spaces, and newline characters

words = line.strip().lower().split(" ")

# This iterates through all the words

for word in words:

 # The following if condition counts the occurrence of each word

 if word in d:

  d[word] = d[word] + 1

 else:

  d[word] = 1

#This prints the words and their frequencies, in descending order

for w in sorted(d, key=d.get, reverse=True):

   print(w, d[w])

Read more about loops at:

brainly.com/question/16397886

You might be interested in
Can you tell me what is rast
Sholpan [36]
A radioallergosorbent test is a blood test using radioimmunoassay test to detect specific IgE antibodies, to determine the substances a subject is allergic to. This is different from a skin allergy test, which determines allergy by the reaction of a person's skin to different substances.
3 0
3 years ago
.All of the following are true with the respect to implicitinvocation except:
katrin2010 [14]

Answer: D) components are instances of abstraction

Explanation:

As, implicit invocation is the process by which it is used by the the software designer for styling the architecture of the software,where the event handling structured are formed in the system. The main aim of the implicit invocation is to separated the conceptual concern for maintaining or improving the ability of the software engineer. It is basically based on the notion of the broadcasting and based on the event driven. The components are the instance of the abstraction which are not used as the components in implicit invocation which are relinquished control the system over the computational performance,this is the major disadvantage of the implicit invocation.  

6 0
2 years ago
Adjust list by normalizing When analyzing data sets, such as data for human heights or for human weights, a common step is to ad
finlep [7]

Answer:

I've implemented this program using python

userinput = int(input("Length: "))

mylist = []

mylist.append(userinput)

for i in range(1,userinput+1):

   userinp = int(input("Input: "))

   mylist.append(userinp)

smallval = mylist[1]

for i in range(1,len(mylist)):

   if smallval > mylist[i]:

       smallval = mylist[i]

for i in range(1,len(mylist)):

   mylist[i] = mylist[i] - smallval

for i in range(1,len(mylist)):

   print(mylist[i],end=' ')

Explanation:

I've added the full source program as an attachment where I used comments to explain difficult lines

4 0
2 years ago
unlike the barcode-based tracking system, a radio frequency identification system offers a .
Over [174]

Unlike the barcode-based tracking system, a radio frequency identification system offers a <u>no-contact, no-line-of-sight reading, and tracking system</u>.

What is a tracking system?

A tracking system often referred to as <u>a locating system, is used to keep </u><u>track </u><u>of people or objects in motion and provide an accurate, timely sequence of location data for processing</u>. Human tracking should be understood; more information is provided below.

<u>Any stolen car can be kept </u><u>track </u><u>of across the nation</u> with the use of a tracking system, ensuring that it is returned as soon as possible. A tracking system is a crucial tool for making sure your personnel is safe.

To learn more about tracking system, use the link given
brainly.com/question/15237193
#SPJ4

8 0
1 year ago
If Mark is developing a website to be optimized for mobile devices, what would be the top-level domain?
umka2103 [35]

Answer:

A top-level domain or the TLD is the domain at the highest level in the hierarchy of the DNS. And that means in the Internet DNS. Also, the top-level domain is installed in the namespace toot zone. And the top-level domain is the .com, in general, to be named as the best one. The next two are the .net and .org. But since it is required to optimize the website for the mobile devices, we should select here .com.

Explanation:

Please check the answer section.

5 0
2 years ago
Other questions:
  • Will upvote all answers
    7·1 answer
  • Switches operate on what layer of the OSI Model
    11·1 answer
  • Antivirus software uses ________ to search for known viruses.
    9·1 answer
  • How to get bing with any node unblocker
    10·2 answers
  • How does the Problem-solving Process help us to solve everyday Problems?
    13·1 answer
  • 9.4 Code Practice: Your task is to determine whether each item in the array above is divisible
    14·1 answer
  • C++ Write a program that initially asks a user to enter two positive integer numbers a and b. If either a or are zero or negativ
    9·2 answers
  • What is output by the following line of code?
    15·1 answer
  • Given three floating-point numbers x, y, and z, output x to the power of y, x to the power of (y to the power of z), the absolut
    15·1 answer
  • Select the correct answer.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!