subject

Exercise 1a
* import the string library.
* create a variable alphabet that consists of the lowercase and uppercase
letters in the english alphabet using the ascii_letters attribute
of the string library.

exercise 1b
* the lower and upper cases of the english alphabet is stored as alphabet.
* consider the sentence 'jim quickly realized that the beautiful gowns are expensive'.
create a dictionary count_letters with keys consisting of
each unique letter in the sentence and values consisting
of the number of times each letter is used in this sentence.
count both upper case and lower case letters separately
in the dictionary.

sentence = 'jim quickly realized that the beautiful gowns are expensive'
count_letters = {}

exercise 1c
* comment your code from 1b to make a function called counter
that takes a string input_string and returns a
dictionary of letter counts count_letters.
* use your function to call counter(sentence)

exercise 1d
* abraham lincoln was a president during the american civil war.
his famous 1863 gettysburg address has been stored as address,
and the counter function defined in part 1c has been loaded.
use these to return a dictionary consisting of the count
of each letter in this address, and save this as address_count.
* print address_count
address = 'abraham lincoln was a president during the american civil war. his famous 1863 gettysburg address'

exercise 1e
* the frequency of each letter in the gettysburg address is already
stored as address_count. use this dictionary to find
the most common letter in the gettysburg address.
* store this letter as most_frequent_letter, and print your answer.

use python for all !

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 20:00
Which type of file can be used to import data into a spreadsheet?
Answers: 1
question
Computers and Technology, 24.06.2019 10:00
Which two technologies support the building of single-page applications?
Answers: 2
question
Computers and Technology, 24.06.2019 10:40
Joe needs to see the slide transitions and animations he has applied to his slides in a large view. which presentation view should he use? in which tab would joe find the animations option to make further changes, if any?
Answers: 1
question
Computers and Technology, 24.06.2019 12:00
An npn transistor is correctly biased and turned on if the a. base is negative. b. collector is negative. c. collector is positive with respect to the emitter and negative with respect to the base. d. collector is the most positive lead followed by the base.
Answers: 1
You know the right answer?
Exercise 1a
* import the string library.
* create a variable alphabet that consists of...
Questions
Questions on the website: 13722360