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

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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