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.:- M92782079
  • Price:- $20

Priced at Now at $20, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Excel discussionconsider this using the mouse to point and

Excel discussion Consider this.... Using the mouse to point and click is one way to work on a computer. Often, the same work can be accomplished using just the keyboard, using shortcut keyboard combinations. For example, ...

What are the similarities and differences of hierachical

What are the similarities and differences of hierachical, Network, and Object Oriented Database Models.

Question a simm has a capacity of 32mx64how many 32mx8

Question : A SIMM has a capacity of 32Mx64. How many 32Mx8 DRAMa are reqquired to make this SIMM? How many address lines does the SIMM require? How should the DRAMs Be connected ?

Bierco is a beer company based in germany you purchased the

BierCo is a beer company based in Germany. You purchased the stock in 2011 for 100 Euros when the exchange rate was 1.4 EUR/ USD. Today BierCo's price is 120 Euros and the exhange rate is 1.12 EUR/USD. What is the dollar ...

Question suppose we deal a 5 card hand from a standard deck

Question : Suppose we deal a 5 card hand from a standard deck. What is the probability that the hand is all Spades, given that it has at least two Spades? The response must be typed, single spaced, must be in times new r ...

Question suppose that the coins of the fictional country of

Question : Suppose that the coins of the fictional country of Combinatoria come in the de- nominations, d1, d2, . . . , dk, where d1 = 1 and the other di values form a set of distinct integers greater than 1. Given an in ...

In system analysisdiscuss and give suggestions or comments

In system analysis Discuss and give suggestions or comments for the following questions: 1. Discuss about the project plan (activities and scheduling) 2. What are the new tools and strategies used in project plan or mana ...

Question suppose a large aerospace engineering firm has

Question : Suppose a large aerospace engineering firm has immediately hired you as a consultant to investigate a potential violation of corporate policy and data theft. You have been informed that an employee may have be ...

Question software introduce ability do you have a document

Question : Software introduce ability do you have a document management system to manage business processes. What is the purpose of a document management system?

Question explain the need for designing procedures for

Question: Explain the need for designing procedures for simple tasks such as creating or modifying access controls. Create a procedure guide that provides clear instructions that anyone with a basic technical knowledge b ...

  • 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