Computers and Technology

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 !

answer
Answers: 2

Similar questions

Do you know the correct answer?
Exercise 1a
* import the string library.
* create a variable alphabet that consists of...

Questions in other subjects:

Konu
Business, 08.07.2019 03:30