Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is for python. 4 of the functions defined below are missing an implementati

ID: 3799222 • Letter: T

Question

This is for python.


4 of the functions defined below are missing an implementation! Finish
the following functions:

1. gen_consecutive_chars()
2. gen_key(password)
3. sub_decrypt(password, ciphertext)
4. vig_decrypt(key, message)

"""

(Question 1, will post other 3 seperately.)


# 1. Implement gen_consecutive_chars()
def gen_consecutive_chars(start=97, end=122):
    """Creates a string composed of all characters starting at unicode
    code point, start, up to and including unicode code point, end. The
    default values return lowercase 'a' through (and including) 'z'

    gen_consecutive_chars() # --> 'abcdefghijklmnopqrstuvwxyz'
    gen_consecutive_chars(start=65, end=66) # --> 'AB'

    :param start: the code point to start the sequence of characters
    :type start: int
    :param end: the code point of the last character included
    :type end: int
    :return: a string consisting of consecutive characters from start
    code point to end code point
    :rtype: str
    """
    # implement this function!
    return ''


def remove_letters(letters, s):
    """Removes every character in letters from string, s.
    :param letters: string of characters to be removed
    :type letters: str
    :param s: string that characters will be removed from
    :type s: str
    :return: a new string with all characters in letters removed from s
    :rtype: str
    """
    new_s = ''
    for ch in s:
        if ch not in letters:
            new_s += ch
    return new_s

def remove_duplicates(s):
    """Removes all duplicate characters in string, s
    :param s: string to remove duplicates from
    :type s: str
    :return: new string without duplicates
    :rtype: str
    """
    new_s = ''
    for ch in s:
        if ch not in new_s:
            new_s += ch
    return new_s

I have no idea where to even start with implementing this function. Can I get a walkthrough? Thank you.

Explanation / Answer

def gen_consecutive_chars(start, end):
s = ''
while(start <= end):
s += chr(start)
start += 1
return s

print gen_consecutive_chars(98, 106)

def remove_letters(letters, s):
for ch in letters:
s = re.sub(ch, '', s)
return s

print gen_consecutive_chars("ab", 'abhi')

Output: "hi"

`

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote