Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Required: 1. Define a function called letters that takes a string called text and returns a dictionary. The dictionary should have 26 keys -- one

Required:

1. Define a function called letters that takes a string called text and returns a dictionary. The dictionary should have 26 keys -- one for each letter of the alphabet (count 'a' and "A" both as occurrences of 'a') -- and the value for each key should be the number of times that letter appears in the text.

2. Write a program that calls letters on the following encrypted text below

Before our next class, email me your letters function and the output of running letters on the encrypted file (you can just paste that output in the body of the email and either paste or attach the letters function part -- if you're doing the optional bonus, do that before sending me the email so you can send a single email).

Optional (bonus):

3. Edit your letters function so that it returns a string (or a list) sorted by how often the letter appears, in decreasing order. For example, if 'k' appeared most, and then 'x', your returned string should start "kx..." (or, if it's a list, ['k', 'x', ... ]).

MUST INCLUDE OPTIONAL BONUS

MUST BE ABLE TO COPY AND PASTE ONTO PYTHON AND IT RUN PERFECTLY

"d vh ocz ompz qdiz, viy ht avoczm dn ocz bvmyzizm. cz xpon jaa zqzmt wmvixc di hz ocvo wzvmn ij ampdo, rcdgz zqzmt wmvixc ocvo yjzn wzvm ampdo cz kmpizn nj ocvo do rdgg wz zqzi hjmz ampdoapg. tjp vmz vgmzvyt xgzvi wzxvpnz ja ocz rjmy d cvqz nkjfzi oj tjp. mzhvdi di hz, vn d vgnj mzhvdi di tjp. ij wmvixc xvi wzvm ampdo wt donzga; do hpno mzhvdi di ocz qdiz. izdoczm xvi tjp wzvm ampdo pigznn tjp mzhvdi di hz."

d vh ocz qdiz; tjp vmz ocz wmvixczn. da tjp mzhvdi di hz viy d di tjp, tjp rdgg wzvm hpxc ampdo; vkvmo amjh hz tjp xvi yj ijocdib. da tjp yj ijo mzhvdi di hz, tjp vmz gdfz v wmvixc ocvo dn ocmjri vrvt viy rdoczmn; npxc wmvixczn vmz kdxfzy pk, ocmjri dioj ocz admz viy wpmizy. da tjp mzhvdi di hz viy ht rjmyn mzhvdi di tjp, vnf rcvozqzm tjp rdnc, viy do rdgg wz yjiz ajm tjp. ocdn dn oj ht avoczmn bgjmt, ocvo tjp wzvm hpxc ampdo, ncjrdib tjpmnzgqzn oj wz ht ydnxdkgzn."

vn ocz avoczm cvn gjqzy hz, nj cvqz d gjqzy tjp. ijr mzhvdi di ht gjqz. da tjp fzzk ht xjhhviyn, tjp rdgg mzhvdi di ht gjqz, epno vn d cvqz fzko ht avoczmn xjhhviyn viy mzhvdi di cdn gjqz. d cvqz ojgy tjp ocdn nj ocvo ht ejt hvt wz di tjp viy ocvo tjpm ejt hvt wz xjhkgzoz. ht xjhhviy dn ocdn: gjqz zvxc joczm vn d cvqz gjqzy tjp. bmzvozm gjqz cvn ij jiz ocvi ocdn: oj gvt yjri jizn gdaz ajm jizn amdziyn. tjp vmz ht amdziyn da tjp yj rcvo d xjhhviy. d ij gjibzm xvgg tjp nzmqvion, wzxvpnz v nzmqvio yjzn ijo fijr cdn hvnozmn wpndiznn. dinozvy, d cvqz xvggzy tjp amdziyn, ajm zqzmtocdib ocvo d gzvmizy amjh ht avoczm d cvqz hvyz fijri oj tjp. tjp ydy ijo xcjjnz hz, wpo d xcjnz tjp viy vkkjdiozy tjp nj ocvo tjp hdbco bj viy wzvm ampdoampdo ocvo rdgg gvnoviy nj ocvo rcvozqzm tjp vnf di ht ivhz ocz avoczm rdgg bdqz tjp. ocdn dn ht xjhhviy: gjqz zvxc joczm."

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_2

Step: 3

blur-text-image_3

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

Database Design Application Development And Administration

Authors: Michael V. Mannino

3rd Edition

0071107010, 978-0071107013

Students also viewed these Databases questions

Question

Challenges Facing Todays Organizations?

Answered: 1 week ago