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
What side length would you specify if you were required to create a regular hexagonal plate that was composed of 33 cm(squared) of sheet metal? dimension the side length to 0.1 cm
Answers: 2
question
Computers and Technology, 22.06.2019 20:10
Assume the existence of a bankaccount class. define a derived class, savingsaccount that contains two instance variables: the first a double, named interestrate, and the second an integer named interesttype. the value of the interesttype variable can be 1 for simple interest and 2 for compound interest. there is also a constructor that accepts two parameters: a double that is used to initialize the interestrate variable, and a string that you may assume will contain either "simple", or "compound", and which should be used to initialize the interesttype variable appropriately. there should also be a pair of functions getinterestrate and getinteresttype that return the values of the corresponding data members (as double and int respectively).
Answers: 2
question
Computers and Technology, 23.06.2019 09:20
How to print: number is equal to: 1 and it is odd number number is equal to: 2 and it is even number number is equal to: 3 and it is odd number number is equal to: 4 and it is even number in the console using java using 1 if statement, 1 while loop, 1 else loop also using % to check odds and evens
Answers: 3
question
Computers and Technology, 23.06.2019 20:00
What multimedia system creates an immersive, real-life experience that the user can interact with?
Answers: 1
You know the right answer?
Exercise 1a
* import the string library.
* create a variable alphabet that consists of...
Questions
question
Mathematics, 25.10.2021 14:50
question
Mathematics, 25.10.2021 15:00
Questions on the website: 13722361