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
To construct a battery with a current of 6 A, you would connect six 1 A cells
m_a_m_a [10]
A. in parallel.,<span>D. in series.</span>
6 0
3 years ago
Read 2 more answers
What if an html code became cracked and formed a bug how can i repair that
Valentin [98]
I suggest you look up a video for it ofc
7 0
3 years ago
Sends a copy of the message and any additional comments to a different e-mail address
Debora [2.8K]

Answer:

Forward.

Explanation:

E-mail is an acronym for electronic mail and it can be defined as a set of written words, texts, characters used for conveying a message from one person to another. It is a channel or medium of communication between one person and the other.

Forward simply sends a copy of the message and any additional comments to a different e-mail address. The term forward is used in email to describe the process of sending a message.

3 0
4 years ago
If you consider your new colleagues a rich source of information about items that your team had not yet discussed or considered,
stepan [7]

Answer:

False

Explanation:

8 0
4 years ago
Read 2 more answers
What are some of the ways that people communicate or share with others over digital<br> media?
stepladder [879]

Answer:

<em>Social networks, apps, websites.</em>

Explanation:

Social media allows others to talk during the pandemic! Weather or not its "Tik-tak" or "Facebok", "Twiter", etc. Social media has made a huge impact on our society as we know it. Social media has broadened our social life now that we can call each other and see each other digitally while a county away. Or even share something on the internet to a million different eyes! Social media also has negative impacts such as cyberbullying and other things.

<u><em>~ LadyBrain</em></u>

6 0
3 years ago
Other questions:
  • What online resource name does a major University end with
    7·2 answers
  • Is co2+4h2--&gt; ch4 + 2h2o a combustion​
    14·1 answer
  • Audrey would like to save her document. She should choose the Save command from the _____. folder menu window directory
    11·1 answer
  • Piers wants to take a course on XML. He is a certified web designer, but he has not used XML before. How can he use XML to impro
    6·1 answer
  • In Microsoft word when you highlight existing text you want to replace , you're in?
    15·1 answer
  • Which type of image would require you to obtain permission from the author to use the image and possibly pay a royalty to the au
    12·1 answer
  • 20 POINTSS!! NEED HELP!!
    12·2 answers
  • You're expecting visitors who will be demanding Mamet access Before they arrive, you can activate a Guest network that has its o
    11·1 answer
  • List 10 ways how can graphic design help the community
    13·1 answer
  • What made the master so angry with his servant?​
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!