Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Question:

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

I also do not understand how to work out the length of the string if you only have to count letters

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92785044
  • Price:- $20

Priced at Now at $20, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Question based upon your company profile install and

Question: Based upon your company profile, install and configure Windows Server within the virtual environment. 1. Ensure that the server name is appropriate for your corporation. 2. Create a complex password for the Adm ...

Suppose a bowl has 9 chips one chip is labeled 1 three

Suppose a bowl has 9 chips. One chip is labeled "1", three chips are labeled "3", and five chips are labeled "5". Suppose two chips are selected at random with replacement. Let the random variable X equal the absolute di ...

Question specify design and implement a class for a card in

Question : Specify, design, and implement a class for a card in a deck of playing cards. The object should contain methods for setting and retrieving the suit and rank of a card. In C++ please

Select one of the discussion topics and respond begin your

Select one of the discussion topics and respond. Begin your response by indicating which question you chose. Discussion topics: Section 1 Should the government set a maximum wage? Why or why not? Section 2 Most people be ...

Suppose you want to represent graphs where the number of

Suppose you want to represent graphs where the number of nodes is unknown in advance, and the nodes IDs are arbitrary (not contiguous). You want the following operations to be performed efficiently: Add a node. Remove a ...

Give an example of a merger or acquisition where technology

Give an example of a merger or acquisition where technology contributed to its failure to produce desired outcomes. What reasons caused the failure? What actions might have helped ensure success?

An important decision places christmas holiday celebrators

An important decision places Christmas holiday celebrators: To buy real or artificial trees? A market research firm reported that 62% of individuals polled preferred an artificial tree. We conduct independent serving of ...

Wat are three 3 major categories of cyber terrorism and

What are three (3) major categories of cyber terrorism and / or information warfare. Among the chosen categories, determine the one (1) that should be the top priority for the federal government to address.

One state lottery has 1100 prizes of 1 145 prizes of 10 20

One state lottery has 1,100 prizes of $1; 145 prizes of $10; 20 prizes of $75; 5 prizes of $285; 2 prizes of $1,080; and 1 prize of $2,300. Assume that 24,000 lottery tickets are issued and sold for $1. 1)  What is the l ...

On a single diagram illustrate the following using the uml

On a single diagram, illustrate the following using the UML notation for objects, links and messages. (a) An object of class Window, with no attributes shown; (b) An object of class Rectangle with attributes length and w ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As