![subject](/tpl/images/cats/informatica.png)
Computers and Technology, 21.03.2020 09:19 tatilynnsoto17
A common use-case for dictionaries is to store word counts. Let's modify our program below to store the count for each unique word. 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
![ansver](/tpl/images/cats/User.png)
Answers: 2
![](/tpl/images/ask_question.png)
![](/tpl/images/ask_question_mob.png)
Another question on Computers and Technology
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 22.06.2019 09:00
Meenu wants to create a high quality drawing in a variety of colours. which device should she use for the same?
Answers: 1
![question](/tpl/images/cats/informatica.png)
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 04:00
Laire writes a letter to her grandmother, in which she describes an amusement park she visited last week. she adds pictures of that place in her letter. which feature of a word processing program will claire to remove unwanted parts of the pictures?
Answers: 3
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 04:20
Which network media uses different regions of the electromagnetic spectrum to transmit signals through air? uses different regions of the electromagnetic spectrum to transmit signals through air.
Answers: 2
You know the right answer?
A common use-case for dictionaries is to store word counts. Let's modify our program below to store...
Questions
![question](/tpl/images/cats/mat.png)
Mathematics, 03.06.2020 13:25
![question](/tpl/images/cats/es.png)
![question](/tpl/images/cats/biologiya.png)
![question](/tpl/images/cats/health.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 03.06.2020 13:25
![question](/tpl/images/cats/health.png)
Health, 03.06.2020 13:25
![question](/tpl/images/cats/istoriya.png)
![question](/tpl/images/cats/health.png)
Health, 03.06.2020 13:25
![question](/tpl/images/cats/biologiya.png)
Biology, 03.06.2020 13:25
![question](/tpl/images/cats/mat.png)
Mathematics, 03.06.2020 13:25
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/en.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/health.png)
Health, 03.06.2020 13:25
![question](/tpl/images/cats/en.png)
English, 03.06.2020 13:25
![question](/tpl/images/cats/mat.png)
Mathematics, 03.06.2020 13:25
![question](/tpl/images/cats/mat.png)
Mathematics, 03.06.2020 13:25
![question](/tpl/images/cats/mat.png)