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
Dmitrij [34]
3 years ago
14

Create a program that reads words.txt (link near top of our home page) in order to: determine the length of the longest word(s)

and output that length plus the first word of this length found. determine the length of the shortest word(s) and output that length plus the first word of this length found determine and output the average length of all the words in the list.
Computers and Technology
1 answer:
Alexeev081 [22]3 years ago
3 0
# In Python 3
# https://pastebin.com/fPSmmE5w

longest = [""]
shortest = None


with open("words.txt") as words:
   for line in words.readlines():
       for word in line.split():
           if len(word) > len(longest[0]):
               longest = [word]
           elif len(word) == len(longest[0]):
               longest.append(word)
           elif shortest is None or len(word) < len(shortest[0]):
               shortest = [word]
           elif len(word) == len(shortest[0]):
               shortest.append(word)


def format_printable(words):
   return ["{}: {}".format(len(word), word) for word in words]


print(
   "Longest:\n",
   "\n".join(format_printable(longest)),
   "\nShortest:\n",
   "\n".join(format_printable(shortest)),
)
You might be interested in
Greg works outside. He is often found cutting grass and making the local park grounds look nice for guests.
kvasek [131]

Answer:

C Landscaper

Explanation:

From what I know about landscapers and from the description that makes the most sense.

3 0
3 years ago
Fill in the blank; "As well as their traditional role of computing data, computers are also extensively used for..."
Vikki [24]

Answer:

Information output and information storage

Explanation:

Output in the form of images, audio, printed on paper, video, 3D models, etc

Storage - saving information internally on hard drive and externally (HDD, SSD, RAID system, etc

6 0
3 years ago
How do you suppose a request travels from one computer to another? How does the request know where to go?
Luden [163]
It can request a signal then transfer certain data points and provide the request. The request knows where to go using certain lines in the data.
4 0
3 years ago
Use the drop-down menus to complete the statements about using section breaks in a document
krok68 [10]

Answer:

layout, next page, continuous

Explanation:

just took it

7 0
3 years ago
5 examples of a linear motion in object.
NNADVOKAT [17]

An example of linear motion is an athlete running 100m along a straight track. Linear motion is the most basic of all motion. ... Neglecting the rotation and other motions of the Earth, an example of linear motion is the ball thrown straight up and falling back straight down.


3 0
3 years ago
Other questions:
  • _____________ is a service that provides access to hardware resources available over the Internet.
    11·1 answer
  • Businesses use a fax cover sheet is to _____. provide detailed service and product information make sure message reaches the rig
    14·2 answers
  • Match each vocabulary word to its definition.
    11·2 answers
  • Company-wide systems that connect one or more local area networks (LANs) or wide area networks (WANs) are called _____. a) legac
    15·1 answer
  • Which of the following extends a network over a large geographic area by connecting local area networks together?
    14·2 answers
  • Which protocol sends a request to view or download a website or file ​
    7·1 answer
  • Please help!!! Question 8
    14·1 answer
  • Write a program that produces the following output: CCCCCCCCC ++ ++ CC ++ ++ CC ++++++++++++++ +++++++++++++++ CC ++++++++++++++
    14·1 answer
  • How to use boolean to check if math answer is correct java
    7·2 answers
  • what uses gps tracking to track vehicles? group of answer choices edge matching. cartography. automatic vehicle location. geogra
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!