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
alexdok [17]
3 years ago
9

A common use-case for dictionaries is to store word counts. Let's modify our program below to store the count for each unique wo

rd. Let's name the dictionary word_counts. This means you need to initialize the count value to 1 for a particular word if you see it for the first time (i.e., it's not already in word_counts) and update the count (by adding 1 to it) if the word is already present in word_counts.
# Code here

# open the file
f = open("words.txt")
# read the text and store in variable
text = ________
# initialize a dictionary
word_counts = ________
# populate the dictionary with words and their associated counts in the text
# for each word in the text (split by spaces)
# if we haven't seen it
# initialize it in the dictionary to a value of 1
# otherwise
# update the count by 1

# print out the word counts
Computers and Technology
1 answer:
baherus [9]3 years ago
8 0

Answer:

word_count={}

for i in text.split:

        if i in word_count:

                word_count[i]+=1

         else:

                 word_count[i]=1

print word_count

You might be interested in
The best presentations try to include as much text as possible on each slide true or false ​
Zina [86]
True is answered of that question
5 0
3 years ago
(ATRCKALLB) __________is an input device that contains a movable ball on the top.​
nikitadnepr [17]

Answer:

trackball

Explanation:

A trackball can be seen on a mouse.

3 0
2 years ago
You work as the IT administrator for a small corporate network. To accommodate specific network communication needs for an upcom
Andreas93 [3]

Answer:

The right answer is option A

Explanation:

To upgrade a network communication to accommodate for specific network needs, what is required is to select and install the network interface with the highest speed to connect to the local network.

Network communications are what we use to connect to the internet. There are different network providers and the provided networks do not have the same network speed due to different reasons. A network interface is what is used to connect our computer to the network provider. It is only logical to get the best network interface card in that region and connect to the fastest speed available.

5 0
3 years ago
I need help now I really do what is the answer thank you
Svetradugi [14.3K]
The answer is c
just replace the y with the y value and the x with the x value
4 0
2 years ago
Which statement is NOT true:
RSB [31]

Answer:

The correct answer for the given question is   "Machine languages can be used to write programs that can run on any machine."

Explanation:

The machine language consist of binary digit i. e 0 and 1 .Computer can understand only the machine language .The machine language consist of code that is written in bits so it is used  to express algorithms.When any program is compiled the compiler are converted into machine code so the machine language is produced by the compiler .

Machine language cannot used to write a program that run on any machine.

5 0
3 years ago
Other questions:
  • Explain how to use fortran programming in details
    14·1 answer
  • You support Richman Investments, a brokerage firm that employs 20 brokers. Each broker has his own client computer, and the firm
    15·1 answer
  • Fill in the correct term to complete the statement. _____ refers to borrowing money from a bank.
    13·2 answers
  • Which statement about the Paste Link option is true? A)Even if the source file (spreadsheet) is deleted, the data updates automa
    11·1 answer
  • Name 3 examples of operating system software that are not Windows based.
    5·1 answer
  • Andy is trying to put together a holiday gift knapsack (with W=8) for Sarah. He has n items to choose from, each with infinitely
    15·1 answer
  • which three objects can be linked or embedded in a word document? A. worksheets, margins, colors B. charts, worksheets, images C
    7·1 answer
  • In chapter 3, we discussed syntax and semantics, in general there are two types of grammars for programming languages, regular a
    14·1 answer
  • Consider the classes below: public class TestA { public static void main(String[] args) { ​ int x = 2; ​ int y = 20 ​ int counte
    6·1 answer
  • What is cyber security ???​
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!