Question

Use python letter_starting_most_unique_words( ) – does not take any input parameters and returns the letter that...

Use python

letter_starting_most_unique_words( ) – does not take any input parameters and returns the letter that starts maximum number of unique words in the datafile.

covid1.txt

COVID-19 is a serious health threat, and the situation is evolving daily. The risk will vary between and within communities, but given the increasing number of cases in Canada, the risk to Canadians is considered high.

This does not mean that all Canadians will get the disease. It means that there is already a significant impact on our health care system. If we do not flatten the epidemic curve now, the increase of COVID-19 cases could impact health care resources available to Canadians.

There is an increased risk of more severe outcomes for Canadians aged 65 and over, with compromised immune systems
and with underlying medical conditions. There are also increased health risks for Canadian travellers abroad.

covid2.txt

In The Face Of Coronavirus, Canadians Are Stepping Up To Help.

In any situation, no matter how dire, people will try to help.

As the rates of coronavirus continue to surge, many Canadians are gripped with panic. But across the country, there are people who are jumping into action to help wherever they can.

For someX, the choice to help came last week, when local food banks made the announcement that they were almost out of supplies. People had already started panic-shopping, taking up most of the local supply of non-perishables and toilet paper, leaving little for the community’s most vulnerable, who rely on food banks.

A store started offering a promotion, offering free earrings to anyone who dropped off a food donation. It did not take long for the idea to take off. Another person offered to help seniors pick up groceries, medicine, or other essentials.

For someY, the decision to help came from the realization that she did not really know a lot of her neighbours. As someone who knew she was young and healthy, she wanted to provide support to the people around her who were more vulnerable, but did not have a clear sense of who those people were.

sample output:

covid1: ['c', 13]

covid2:   ['s', 14]

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Here is the code (with comments explaining the logic):

def letter_starting_most_unique_words(): returns the letter that starts maximum number of unique words in the datafile! 0

-----------------------------------------------------------------------------------------------------------------------------
Here is the output:

> python3 word_counter.py Enter the name of the file: covid1.txt [c, 13] » python3 word_counter.py Enter the name of the fi

-----------------------------------------------------------------------------------------------------------------------------
Here is the same code (Without comments, for better readability):

| def letter_starting_most_unique_words(): returns the letter that starts maximum number of unique words in the datafile

-----------------------------------------------------------------------------------------------------------------------------
Here is the same code (available to copy-paste onto your compiler/text-editor for testing):

(Kindly follow the indentation by referring to the screenshots provided above)

 def letter_starting_most_unique_words(): '''returns the letter that starts maximum number of unique words in the datafile''' filename = input("Enter the name of the file: ") with open(filename) as f: words = f.read().split() unique_word = set() for word in words: unique_word.add(word.casefold()) first_letter_counter = {} for word in unique_word: letter = word[0] if letter in first_letter_counter: first_letter_counter[letter] += 1 else: first_letter_counter[letter] = 1 max_count = 0 for letter, count in first_letter_counter.items(): if count >= max_count: max_count = count max_letter = letter return [max_letter, max_count] print(letter_starting_most_unique_words()) 

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

If you have any doubts, feel free to ask in the comments.
If you found this answer helpful, please consider giving a like :)

Add a comment
Know the answer?
Add Answer to:
Use python letter_starting_most_unique_words( ) – does not take any input parameters and returns the letter that...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • International business in the Aftermath of Corona Virus. based on the article from Italy coronavirus deaths...

    International business in the Aftermath of Corona Virus. based on the article from Italy coronavirus deaths at 5,476 after 651 rise: Live updates. please and the question below thanks. 1. With all the deaths happening in Italy, China, and all around the world, what do you think the impact will be upon international business? Will it stop? Will it slow down? 2. Secondly, as students of international business I have to assume that you are interested in doing business abroad....

  • The world’s 3 billion-plus smartphones emit the kind of data that health authorities covet during outbreaks....

    The world’s 3 billion-plus smartphones emit the kind of data that health authorities covet during outbreaks. They show where individuals are, where they’ve been and who they might have talked to or even touched — potentially offering maps to find infected people and clues to stopping new ones. But gaining access to this data, even amid a global pandemic, is made complex by the legal and ethical issues surrounding government access to information that can reveal intimate details about citizens’...

  • Cultural and personal expectations influence what is appropriate in any given situation. The best use of...

    Cultural and personal expectations influence what is appropriate in any given situation. The best use of your time is to master a series of key behaviors that work well in every setting It’s never appropriate to laugh when a patient makes a joke about his or her condition Ignore what others are saying 1 points    QUESTION 39 All of the following are important to our definition of communication EXCEPT: personal goals shared meaning autonomy sensitivity 1 points    QUESTION...

  • Case Study: The Buck Stops Here Read the case study on page 384 of your Human...

    Case Study: The Buck Stops Here Read the case study on page 384 of your Human Resource Management in Health Care text. For your post, use content from the readings to answer the following question: How would you advise Mary to proceed to address the situation, while avoiding unintentional unlawful employment discrimination practices under Title VII of the Civil Rights Act?   Case Study: “The Buck Stops Here” Mary Johnson, a registered nurse, and the new manager of the clinical staff...

  • CASE STUDY:"They Like It the Way It Is"

    Rita is head cocktail server at a high-volume singles bar that serves both food and drinks. She has CASE STUDY: "They Like It the Way It Is" responsibility for a large staff of part-timers, most of whom she worked with as a server before she was promoted. They are a lively bunch who regard themselves more as independent entrepreneurs doing business at this particular place than as loyal employees. Most of them pay little attention to rules, but they are...

  • Read this furunculosis article then answer questions: From The New England Journal of Medicine May 2,...

    Read this furunculosis article then answer questions: From The New England Journal of Medicine May 2, 2002 (Volume 346, Number 18) An Outbreak of Mycobacterial Furunculosis Associated With Footbaths at a Nail Salon Winthrop KL, Abrams M, Yakrus M, et al. The New England Journal of Medicine. 2002;346(18):1366-1371 There is no arguing that over the past few years in the United States, people have increasingly been using the services of pedicurists and nail salons. As with any social trend, there...

  • Cancer: Failure to Communicate Farhad Tabrizi, a 69-year-old immigrant from Iran, is brought to the emergency...

    Cancer: Failure to Communicate Farhad Tabrizi, a 69-year-old immigrant from Iran, is brought to the emergency room at St. Vincent's Medical Center (a private urban hospital) after coughing up blood. He presents with severe coughing, fatigue, chest pain, shortness of breath, and headaches. After stabilizing Mr. Tabrizi, the emergency room team admits him to the hospital, where he is given (over the course of a few days) a thorough workup, including chest x-rays, CT scans, mediastinascopy, and a PET scan....

  •    Available Feb 11 at 12am - Mar 8 at 11:59pm 26 days Not for IV...

       Available Feb 11 at 12am - Mar 8 at 11:59pm 26 days Not for IV Use: The Story of an Enteral Tubing Misconnection The Story of Robin and Addison Lowe (United States) LEARNING OBJECTIVES After completing this case study, you will be able to: 1. Explore the scientific feld of human factors and how errors like tubing misconnections can be prevented. 2. Discuss the complexity of having two patients to treat, a mother and her fetus. 3. Describe suitable...

  • Dehydration 15. Read pages 74 76 in the text. Complete the table below. ou might observe...

    Dehydration 15. Read pages 74 76 in the text. Complete the table below. ou might observe if What you might observe if a person is dehydrated What you might ask a dying person to better understand their needs Comfort measures that might be helpful Delirium 11 unter who is very concerned Dehydration The family called me into the room and told me "Mom isn't drinkin mouth is dry. She is sleeping all the time she does not woke up when...

  • Use the answer sheet provided for the project to identify which (if any) of the events...

    Use the answer sheet provided for the project to identify which (if any) of the events or sitautions described happened in each cases. Use our report template to create a report for the medical staff review committee. Under conclusion discuss one process change that can be implemented to reduce risk exposure and provide at least two ways in which change can be managed smoothly when implementing the new process.   Presume you are a data analyst in the hospital health information...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT