Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question # 5 : frequency ( txt ) 5 pts Returns a dictionary with the frequency count of each alphabet letter ( in lowercase )
Question #: frequencytxt pts
Returns a dictionary with the frequency count of each alphabet letter in lowercase in txt You
cannot make assumptions about the contents in txt
Preconditions and Postconditions
txt: nonempty str
Returns: dict frequency count
Useful methods:
The strisalpha method returns True if all characters in the string are alphabetic and there
is at least one character, False otherwise.
o sisalpha returns True
o isalpha returns False
The strlower method returns a copy of the string with all the cased characters converted
to lowercase.
o Alower returns a
ord returns an integer representing the Unicode code point of that character.
o orda returns
You are NOT allowed to use the count method or any other Python count libraries such as
Counter, mode, the min and max methods. You will not get credit if you used them in your
code, even if your code passed the test cases.
Example:
frequencymama
m: a:
answer frequencyWe ARE Penn State!!!
answer
w: e: a: r: p: n: s: t:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started