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
What the benefit is of folders when working with files
Aleksandr [31]
There are many benefits to using folders when working with lots of files.  Here are a few examples:

- You can use folders to sort your files by type, almost like drawers in a desk, so you might have folders for Music, Photographs, Documents, etc.

- You can use folders to group files together into a specific group.  For example in your Photographs folder you might have a folder titled BirthdayPhotographs for all the photographs from your birthday.

- As in the example above you can nest folders to create sub-categories.  Documents might include folders for Homework, Stories, Poems

- Folders can have different permissions applied to them, allowing you to keep personal files in a private folder only you can access, or secret files in a folder that doesn't show up in the normal list of folders!
4 0
3 years ago
Read 2 more answers
kate decides to download an extension to her favorite browser to quickly store links on her spreadsheet software. while download
uranmaximum [27]

By ignoring the opt-out check box that allows the extension to download a search toolbar, the error which has occurred here is that: d. Kate has installed a potentially unwanted program (PUP).

<h3>What is a software?</h3>

A software can be defined as a set of executable instructions that is typically used to instruct a computer system on how to perform a specific task (function) and proffer solutions to a particular problem.

<h3>What is a potentially unwanted program (PUP)?</h3>

A potentially unwanted program (PUP) can be defined as a piece of software that's bundled into download packages and may be unwanted by the end user because it offers no benefits or may pose high risk.

In this scenario, we can reasonably infer and logically deduce that the error which has occurred here is that Kate has installed a potentially unwanted program (PUP) because she ignored the opt-out check box which then allowed the extension to download a search toolbar.

Read more on potentially unwanted program here: brainly.com/question/25091456

#SPJ1

Complete Question:

Kate decides to download an extension to her favorite browser to quickly store links on her spreadsheet software. While downloading the software, she ignores the opt-out check box that allows the extension to download a search toolbar.

What has occurred here?

a. Kate has installed an injection.

b. Kate has installed a backdoor.

c. Kate has installed a Trojan.

d. Kate has installed a potentially unwanted program (PUP).

4 0
1 year ago
Phases of systems development life cycle do developers identify the particular features nd functions of a new system
ki77a [65]

The phase where developers identify the particular features and functions of a new system is the requirement and analysis stage.

<h3>What is system development?</h3>

System development is the process of defining, designing, testing, and implementing a new software application or program.

System development has a life cycle. The primary stages are as follows;

  • Planning stage
  • Requirement and Analysis
  • Design
  • Development
  • Testing
  • Implementation.
  • Operation and maintenance.

Therefore, the phase where developers identify the particular features and functions of a new system is the requirement and analysis stage.

learn more on system development here: brainly.com/question/13042526

#SPJ12

7 0
2 years ago
Read 2 more answers
Choose the parts of the browser window.
8_murik_8 [283]

Answer:

The answer is "Title bar".

Explanation:

The title bar is located on top of the screen, its color blue, which is used in browsers. It has the function, that shows the title of the web page, that you currently viewing, and other choices were wrong, which can be described as follows:

  • Enter bar is the wrong option because it is not a part of the browser.
  • The back button is also known as a backspace key which is used to delete so thing, which is written by keyboard, that's why it is wrong.
  • The forward bar is used in pipe in a module that's why it's incorrect.

4 0
3 years ago
Ith what frequency do balance changes happen in the game?​
Akimi4 [234]
What game ? I’m not sure what ur trying to ask
8 0
3 years ago
Read 2 more answers
Other questions:
  • Jenny is going on a trip to wildlife safari with her friends. She wants a camera that will help her shoot fast-moving animals. W
    15·2 answers
  • Despite its vivid design, the website for Lolly's Bookstore did not seem to attract customers who lingered. In fact, most websit
    13·1 answer
  • Jenis-jenis grafik bagi imej​
    10·1 answer
  • You can write as many constructors for a class as you want, as long as they all have different ____ lists.
    8·1 answer
  • In Joan Woodward's study of the relationship between technology and structure, the structure that was the most technically compl
    6·1 answer
  • 4. Written record of all transactions in your checking account
    5·2 answers
  • Knowing the meaning of the acronym WAS I WHY can be most helpful to you when you?
    14·1 answer
  • Why is making a model, or prototype, important in the design process?
    6·1 answer
  • Algorithm 1$ =RS 150<br><br>​
    5·2 answers
  • Question 8 A data analyst is working with a data frame named stores. It has separate columns for city (city) and state (state).
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!