Question: IMPORTANT : make sure that you use createAlphabet() as the helper function to generate the alphabet used by the encryption/decryption routines. You should be able

IMPORTANT: make sure that you use createAlphabet() as the helper function to generate the alphabet used by the encryption/decryption routines. You should be able to change the alphabet returned by createAlphabet() and all your other functions should still work correctly.

def createAlphabet():

"""

createAlphabet returns a string that includes

all lowercase letters,

followed by all upper-case letters,

then a space, a comma, a period, a hyphen('-'),

a tilde('~'), and a pound symbol ('#').

NOTE: the order of characters in the alphabet is

very important!

In other words, the string being returned will be

'abcdef...xyzABCDEF...XYZ ,.-~#' (the ellipses ...

hide the alphabet letters)

"""

lc = string.ascii_lowercase

uc = string.ascii_uppercase

return lc + uc + " ,.-~#"

getCharacterBackward(char, key) - return left-shifted character.

After being called, it gets the character to the left of char by moving backward by the specified key positions in the alphabet. For example, if you this function with the parameter c and 2 the result is a and if you call it with a and len(createAlphabet()) the result is a because you are essentially moving over all the characters and so the result is the initial character.

def getCharacterBackward(char, key):

"""

Given a character char, and an integer key,

the function shifts char backward `key` steps.

Return the new character.

If `char` is not a single character, return `None`.

If `key` is not an integer, return -1.

"""

return "stub"

PLEASE ONLY USE FOR OR WHILE LOOP

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!