Question: def frequency(text): ###cant use chr or ord functions Return value: A list (of integers): how often each letter of the alphabet appears in text Assumptions:

def frequency(text): ###cant use chr or ord functions

Return value: A list (of integers): how often each letter of the alphabet appears in text Assumptions: o The standard English alphabet is used: "abcdefghijklmnopqrstuvwxyz" o All strings will be entirely in lowercase, and only contain valid letters in the alphabet.

How it works: o Count how many times each letter in the alphabet occurs in the text.

Store all of these values in a list. This list should be returned in alphabetical order:

index 0 is the frequency of the letter "a" index 1 is the frequency of the letter "b" index 2 is the frequency of the letter "c" so on until the letter "z"

Notes: HINT: If you haven't written the tally() function yet. you should do that first.

Don't use list.index() or list.count() !

Examples:

frequency("abcd") [1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]

frequency("zoosarecool") [1,0,1,0,1,0,0,0,0,0,0,1,0,0,4,0,0,1,1,0,0,0,0,0,0,1]

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!