Purpose of counting occurrances

Assignment Help Basic Computer Science
Reference no: EM131943412

Please help with this python 3 programming question:

Using the function max_relative_frequency(s) which takes as argument a string and returns the highest relative frequency of any letter in the string. This value is unique. There can be several letters that occur with an equal (highest) frequency, but in that case their relative frequency is the same.

  • Consider only letters of the English alphabet (that is, 'a' through 'z').
  • For the purpose of counting occurrances, consider letters that differ only by case to be the same letter. For example, the letter 'n' occurs three times in the string "Non-even" (once in upper case, twice in lower case).
  • For the purpose of counting the total number of letters in the string, count only letters. For example, the string '0 << c++ << 9' contains only one letter, 'c', so the relative frequency of 'c' in this string is 1.
  • If the string contains no letter, the relative frequency is undefined and your function should return 0.

Examples:

  • The string 'sufficit' has 8 letters, and the most frequent letters are f and i, which both occur twice. Thus, the highest relative frequency is 2/8.
  • The string 'Non-even' has 7 letters (- is not a letter), and the most frequent letter is n which occurs three times (one N and two n). Thus, the highest relative frequency is 3/7.

Therefore, the answers for maximum relative frequency which returns the highest relative frequency of letters in a string must be a fraction, or decimal and between 0 and 1

Reference no: EM131943412

Questions Cloud

Should new ventures be added or old ones subtracted : Outline strategies on how the firm should respond to the changes in the economic indicators with the goal of maximizing revenues in the years ahead.
Discuss externalities of coal mining mentioned over course : Discuss the externalities of coal mining mentioned over the course of the film. Is coal a cheap source of energy? Be thoughtful and specific.
Difference between individual and institutional racism : What did Peggy McIntosh mean when she said, "I was taught to recognize racism only in individual acts of meanness by members of my group." (page 5)
Describe the trends in the non-alcoholic beverage industry : Explain the approach you will use to implement this strategic position in order to distinguish your beverage from other non-alcoholic beverages.
Purpose of counting occurrances : Consider only letters of the English alphabet (that is, 'a' through 'z').
Which model would be the best choice : You have become very successful and are considering the purchase of a plane for your firm. The Piper model has an initial cost of $375,000.
What would you say to the president of a developing nation : What would you say to the president of a developing nation, such as Indonesia, in which a great deal of forest is being cleared?
Permission and approval from management of organization : Ethical hacking is performed with permission and approval from management of an organization.
How much of the judgment would the insurance cover : Becky Fenton has 90/180/100 automobile insurance coverage. If two other people are awarded $135,000 each for injuries in an auto accident in which Becky.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Integration affect the even-odd property

How does differentiation and integration affect the even-odd property of a function? For integration, assume the constant of integration is 0.

  Create an html5document

Create an HTML5document that contains links to 5 daily deal sites (like Groupon or Living Social) The page should contain the heading "My Favorite Daily Deals Web Sites." Should be able to click on the links to test the page.

  Explore the pairs trading strategy for each pair of stocks

Are there characteristics of stocks that seem to lead to larger gains? Does this provide insight into when pairs trading might work or fail?

  Vulnerabilities the terms threat

Topic 1: Threats, Risks, and Vulnerabilities The terms threat, risk, and vulnerability are sometimes used interchangeability. However, these terms have distinct meanings and must be used properly when conducting risk assessments and protecting sys..

  Recursive relationship between research methods and data

recursive relationship between research methods and data collection techniques

  Reduce the running time by at most a factor of two

Consider a program that accesses a single I/O device and compare unbuffered I/O to the use of a buffer. Show that the use of the buffer can reduce the running time by at most a factor of two.

  Component of the collective bargaining agreement

Management rights are a key component of the collective bargaining agreement.

  Foreign exchange subscriber and foreign exchange office

What is the major difference between Foreign eXchange Subscriber(FXS) and Foreign eXchange Office (FXO)

  Successful project manager

Year 2022, you are a successful Project Manager and have recently hired a new internee (who haven't taken software engineering course yet) to strengthen industry-academia linkage. One day, the internee enters to your office and says "Why our cust..

  What is exactly bowles argument

What is exactly Bowles argument and how sucessful is he explaining it in his book Capitalism by Paul Bowles

  First national bank president congratulates

First National Bank's president congratulates you on successfully managing her network's addressing issues. Shen then shares that she's considering upgrading the bank's network from IPv4 to IPv6.

  Moderate alcohol consumption

In a study examining the effect of alcohol on reaction time, it was found that even moderate alcohol consumption significantly slowed response.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd