Question: write a code using Python that returns the most commonly occurring letter as a fraction of the string e.g. Non-even would return 3/7. This is

write a code using Python that returns the most commonly occurring letter as a fraction of the string e.g. "Non-even" would return 3/7. This is what I have so far, write a code using Python that returns the most commonly occurring letter and it returns [2,3,1,1]

import fractions def max_relative frequency (s): Alphabet[ nits: I (s.lower).count(Alphabet[i])) for i in rang(en(Alphabet)) if s.lower().count (Alphabet[il) t- max (hits) for frequency in hits (str(fractions.Fraction(t).limit denominator())) return (hits)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!