Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

def frequency(text): Return value: A list (of integers): how often each letter of the alphabet appears in text Assumptions: o The standard English alphabet is

def frequency(text):

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Current Trends In Database Technology Edbt 2006 Edbt 2006 Workshops Phd Datax Iidb Iiha Icsnw Qlqp Pim Parma And Reactivity On The Web Munich Germany March 2006 Revised Selected Papers Lncs 4254

Authors: Torsten Grust ,Hagen Hopfner ,Arantza Illarramendi ,Stefan Jablonski ,Marco Mesiti ,Sascha Muller ,Paula-Lavinia Patranjan ,Kai-Uwe Sattler ,Myra Spiliopoulou ,Jef Wijsen

2006th Edition

3540467882, 978-3540467885

More Books

Students also viewed these Databases questions

Question

=+What are bottlenecks in human information processing?

Answered: 1 week ago

Question

7. Understand the challenges of multilingualism.

Answered: 1 week ago