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
weeeeeb [17]
3 years ago
15

Here's something to stop you from getting repetitive when writing essays. Write a program that reads multiple lines of plain tex

t from the user, then prints out each different word in the input with a count of how many times that word occurs. Don't worry about punctuation or case – the input will just be words, all in lower case. Your output should list the words in alphabetical order.

Computers and Technology
1 answer:
Marianna [84]3 years ago
7 0

Answer:

The output is attached below

Explanation:

d = {}

while True:

line = input("Enter line: ")

if len(line)==0:

break

token = line.split(' ')

for var in token:

try:

if len(var)==0:

continue

count = d[var]

d[var] = count + 1

except KeyError:

d[var] = 1

pass

for word in sorted(d):

print(word , d[word])

------------------

You might be interested in
A loop that will output every other name in the names list.
Nuetrik [128]

Answer:

names = ['Peter', 'Bruce', 'Steve', 'Tony', 'Natasha', 'Clint', 'Wanda', 'Hope', 'Danny', 'Carol']

numbers = [100, 50, 10, 1, 2, 7, 11, 17, 53, -8, -4, -9, -72, -64, -80]

for index, element in enumerate(names):

if index % 2 == 0:

 print(element)

for num in numbers:

 if num >= 0:

   print(num, end = " ")

count = 0

for i in numbers:

 count += i

avg = count/len(numbers)

print("sum = ", count)

print("average = ", avg)

for num in numbers:

 if num % 2 != 0:

   print(num, end = " ")

Explanation:

I'm stuck on the last two.. I have to do those too for an assignment.

4 0
3 years ago
Javascript is an object-based programming language that involves working with the properties and methods associated with objects
dimulka [17.4K]

Answer:

True

Explanation:

You can set variables and make method functions.

4 0
2 years ago
Two independent customers are scheduled to arrive in the afternoon. Their arrival times are uniformly distributed between 2 pm a
seraphim [82]

Answer:

1/3

Explanation:

T₁ , T₂ , be the arrival times of two customers.

See expected time for the earliest and latest below.

The formulas used will guide you.

4 0
3 years ago
I neeeeed a girl that is looking for true love, trust me i will love her
nignag [31]

Answer:

sure!

Explanation:

4 0
2 years ago
Read 2 more answers
Mario was surprised that the box that was supposed to tell him how many words he used in his document did not appear after the s
Nookie1986 [14]

Answer:

Click the Display tab

Explanation:

Choose the Word count option to make it visible, within the Display tab dropdown

7 0
3 years ago
Read 2 more answers
Other questions:
  • Is there such a thing as an ethical reason for unauthorized access into a computer system?
    15·1 answer
  • In cell R9, enter a formula using the AVERAGEIF function to determine the average number of years of experience for lifeguards.
    12·1 answer
  • Select the statements that are true regarding the future of technology. Select 2 options.
    10·2 answers
  • Files with what two file extensions are commonly known as tarballs??
    8·1 answer
  • What does the internet engineering task force (IEFT) do?
    5·1 answer
  • Which of these is a Microsoft certification for system engineers?
    9·1 answer
  • Does Buzz or APEX shows all your due assignments on the left of the main home screen?
    11·1 answer
  • The following program is supposed to display a message indicating if the integer entered by the user is even or odd. What is wro
    13·1 answer
  • You started writing a paper yesterday. You worked on it again today. After a few hours, you realized that you have introduced so
    15·2 answers
  • explain why you can determine machine epsilon on a computer using IEEE double precision and the IEEE Rounding to Nearest Rule by
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!