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
Why computer is known as versatile and diligent device ?explain​
pashok25 [27]

They are versatile because they can be used for all sorts of tasks. They can also do many of the same tasks in different ways. They are diligent because they will do a task thoroughly until it is finished.

They work at a constant speed to do the task. Unlike a human, they will not slow down or get bored or start making mistakes that they were not doing earlier. So once they are programmed correctly to do a task, they will do it diligently.

6 0
3 years ago
Janice usually works on a particular workbook that contains all business related data. She decides to keep a backup of all the d
quester [9]

The answer is to use the Ctrl and C keys on the keyboard to copy content from one workbook to another.

The Ctrl and C key is the standard combination keys on the keyboard that is used to copy any selected text or objects while in a user interface environment. Janice is required to press the C key while holding down the Ctrl key to copy all the content to the new workbook.

Another way of doing it is to make sure that both source and target workbooks are open. Navigate the sheets you want to copy or move in the source workbook. Click the Home tab and select then format dropdown in the Cells group. Select move or copy sheet option in the Organize sheet option. Choose the target workbook from the To Book dropdown and click OK.

6 0
3 years ago
Read 2 more answers
Which form of media allows the audience to share in and comment on the content immediatly
Luba_88 [7]

twitter

they will allow you to share comments about any topic you want

4 0
3 years ago
On a client/server network, which computer initiates the process of assigning an IP address through DHCP?
Vera_Pavlovna [14]

Answer:

The client

Explanation:

On a client/server network, THE CLIENT computer initiates the process of assigning an IP address through DHCP. This is because "The Client" computer will serve as the Domain controller in which other computers of the network can find. Hence, The Client computer initiates the process of assigning IP addresses through DHCP to achieve this.

Though, in some case. A user can manually assign the IP address to computer if it is not through DHCP

4 0
3 years ago
In Revit, BIM provides a variety of model information. Which piece of information is not offered by BIM? Select Answer A) Payrol
gizmo_the_mogwai [7]

Answer:

yeet my points into my wallet i need brainliest for points plzz

i actually think scheduling im 11 so i dont know dude

4 0
3 years ago
Other questions:
  • The house had a wonderful pool of ... (his/its/our) own.​
    5·1 answer
  • What is an electronic tool that stores large amounts of data in one place in a systematic, logical way? A Database B Platform C
    5·1 answer
  • An IT specialist is consulted about setting up a peer-to-peer network. What would the specialist say about security risk in this
    14·2 answers
  • As time goes on, technology is likely to _______. A. Increase in complexity b. Decrease in complexity c. Stay at the same comple
    8·1 answer
  • URGENT!!! Which file format is used mainly in the Microsoft Windows operating system?
    15·2 answers
  • You've been given a network of 130.0.0.0 /16. you need to divide it into four VLSM subnets as follows:
    8·1 answer
  • Select the correct answer.
    13·2 answers
  • What critical-thinking tool is being used when asking the question, "Is there a large enough scope of
    10·1 answer
  • Which layer of the OSI model provides a user interface in the form of an entry point for programs to access the network infrastr
    10·1 answer
  • How does 5G technology enhance the Internet of Things (ioT) ?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!