Exercise 1a
* import the string library.
* create a variable alphabet that consists of...
![Computers and Technology](/tpl/images/cats/informatica.png)
Computers and Technology, 03.12.2019 05:31, YeetBoi786
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](/tpl/images/cats/otvet.png)
Answers: 2
Similar questions
![Предмет](/tpl/images/cats/informatica.png)
Computers and Technology, 25.06.2019 06:00, tay8556
Answers: 3
![Предмет](/tpl/images/cats/informatica.png)
Computers and Technology, 15.10.2019 18:20, briweaver9993
Answers: 2
![Предмет](/tpl/images/cats/informatica.png)
Computers and Technology, 31.10.2019 03:31, jacken
Answers: 3
![Предмет](/tpl/images/cats/mat.png)
Mathematics, 02.12.2019 21:31, alexx2595
Answers: 1
Do you know the correct answer?
Questions in other subjects:
![Konu](/tpl/images/cats/istoriya.png)
History, 08.07.2019 03:30
![Konu](/tpl/images/cats/istoriya.png)
![Konu](/tpl/images/cats/biologiya.png)
![Konu](/tpl/images/cats/istoriya.png)
History, 08.07.2019 03:30
![Konu](/tpl/images/cats/mat.png)
![Konu](/tpl/images/cats/mat.png)
![Konu](/tpl/images/cats/es.png)
![Konu](/tpl/images/cats/ekonomika.png)
Business, 08.07.2019 03:30
![Konu](/tpl/images/cats/istoriya.png)