Great Deal! Get Instant \$10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

# Exercise 1 1 point possible (graded) In Exercise 1, we will define the alphabet used in the cipher. The sample code imports the string library has been imported. Create a string called alphabet...

Exercise 1
In Exercise 1, we will define the alphabet used in the cipher.
The sample code imports the string li
ary has been imported. Create a string called alphabet consisting of the space character (' ') followed by (concatenated with) the lowercase letters. Note that we're only using the lowercase letters in this exercise.
Sample code:
import string
What is the co
ect way to create the alphabet string using the string li
ary?
alphabet = string.ascii_lowercase
alphabet = string.ascii_lowercase + " "
alphabet = " " + string.ascii_letters
alphabet = " " + string.ascii_lowercase
alphabet = string.ascii_letters + " "
SubmitYou have used 0 of 2 attemptsSome problems have options such as save, reset, hints, or show answer. These options follow the Submit button.
Exercise 2
In Exercise 2, we will define a dictionary that specifies the index of each character in alphabet.
Note that alphabet is as defined in Exercise 1. Create a dictionary with keys consisting of the characters in alphabet and values consisting of the numbers from 0 to 26. Store this as positions.
What is the value of the key n in the positions dictionary?

SubmitYou have used 0 of 5 attemptsSome problems have options such as save, reset, hints, or show answer. These options follow the Submit button.
Exercise 3
In Exercise 3, we will encode a message with a Caesar cipher.
Note that alphabet and positions are as defined in Exercises 1 and 2. Use positions to create an encoded message based on message where each character in message has been shifted forward by 1 position, as defined by positions.
Note that you can ensure the result remains within 0-26 using result % 27.
Store this as encoded_message.
Use this code to get started:
message = "hi my name is caesar"
What is encoded_message?
SubmitYou have used 0 of 10 attemptsSome problems have options such as save, reset, hints, or show answer. These options follow the Submit button.
Exercise 4
In this Exercise 4, we will define a function that encodes a message with any given encryption key.
Use alphabet, position, and message as defined in Exercises 1 through 3. Define a function encoding that takes a message as input as well as an int encryption key key to encode a message with the Caesar cipher by shifting each letter in message by key positions.
Your function should return a string consisting of these encoded letters.
Use encoding to encode message using key = 3 and save the result as encoded_message. Print encoded_message.
What is the new encoded_message?
SubmitYou have used 0 of 10 attemptsSome problems have options such as save, reset, hints, or show answer. These options follow the Submit button.
Exercise 5
In Exercise 5, we will decode an encoded message.
Instructions
Use encoding to decode encoded_message.
Store your encoded message as decoded_message.
Print decoded_message. Does this recover your original message?
What key can be used to decode the message and recover the original message shifting backwards?
6) What is Project Gutenberg?
An online repository of publically available books in many languages
An online repository of electronically-scanned microfiche copies of the original works of Martin Luthe
An online translation service that can be used for any text file, including entire books
7)The function count_words is as defined in Video 3.2.2.
Consider the following code:
len(count_words("This comprehension check is to check for comprehension."))
What does this return?
5
6
7
8
8)The functions count_words and count_words_fastare as defined in Video XXXXXXXXXXConsider the following code:
count_words(text) is count_words_fast(text)
What does this return?
True
False
9) Which of the two versions of Romeo and Juliet from Project Gutenberg contains more unique words, the original or the German translation?
The original
The German translation
The two contain the same number of unique words
10)What type of object does os.listdir return?
string
int
list
tuple
11)What pandas method allows you to insert a row to a dataframe?
insert
ind
ow
loc
12)How can you increase a numerical title_num value by 1?
title_num ++
title_num += 1
title_num =+ 1
title_num + 1
13)How can you retrieve the first and last few rows of a pandas dataframe called stats?
stats.first() and stats.last()
stats.begin() and stats.end()
Answered Same Day Jun 12, 2021

## Solution

Neha answered on Jun 13 2021
import string
#Exercise 1
alphabet = " " + string.ascii_lowercase
print(alphabet)
#Exercise 2
position = {}
p = 0
for c in alphabet:
position[c] = p
p += 1
print(position['n'])
#Exercise 3
message = "hi my name is caesar"
encoded_message = ''
for c in message:
for key, values in...
SOLUTION.PDF