Ejemplo n.º 1
0
def encrypt(text, rot):
    encrypted = ""
    for ch in text:
        encrypted += rotate_character(ch, rot)
    return encrypted
Ejemplo n.º 2
0
def encrypt(text, rot):
    encrypted_text = ""
    for i in text:
        encrypted_text = encrypted_text + rotate_character(i, rot)
    return encrypted_text
Ejemplo n.º 3
0
def encrypt(text, rot):
    alphabet = "abcdefghijklmnopqrstuvwxyz"
    encrypted_string = ""
    for character in text:
        encrypted_string += rotate_character(character, rot)
    return encrypted_string
Ejemplo n.º 4
0
def encrypt(text, rot):
    encrypted = ''
    for char in text:
        encrypted += rotate_character(char, rot)
    return encrypted
Ejemplo n.º 5
0
def encrypt(text, rot):
    new_text = ''
    for i in text:
        new_text = new_text + rotate_character(i, rot)
    return new_text
Ejemplo n.º 6
0
def encrypt(text, rot):
    a_list = [char for char in text]
    return ''.join(rotate_character(item, rot) for item in a_list)
Ejemplo n.º 7
0
def encrypt(text, rot):
    new_text = ""
    for i in text:
        new_text += rotate_character(i, rot)
    return "".join(new_text)
Ejemplo n.º 8
0
def encrypt(text, rot):
    x = ""
    for n in text:
        x = x + rotate_character(n, rot)
    return (x)
Ejemplo n.º 9
0
def encrypt(text, rot):
    result = ""
    for i in text:
        result += rotate_character(i, rot)
    return result
Ejemplo n.º 10
0
def encrypt(text, rot):
    encrypted_message = ''
    for i in text:
        encrypted_message += rotate_character(i, rot)
    return encrypted_message
Ejemplo n.º 11
0
def encrypt(text, rot):

    alphabet_position(text)
    encrypted_message = rotate_character(text, rot)

    return encrypted_message
Ejemplo n.º 12
0
def encrypt(text, rot):
    return "".join([rotate_character(char, rot) for char in text])
Ejemplo n.º 13
0
def encrypt(text, rot):
    new_message = ''
    for letter in text:
        new_message += rotate_character(letter, rot)
    return new_message
Ejemplo n.º 14
0
def encrypt(text, rot):
    new_str = ""
    for letter in text:
        new_str += rotate_character(letter, rot)
    return new_str
Ejemplo n.º 15
0
def my_test():
    """ Cursory testing of caesar.py functions """
    
    #  alphabet_position(letter) 

    print("Testing alphabet_position(letter)...\n")
    my_test_equal(alphabet_position('a'), 0)
    my_test_equal(alphabet_position('A'), 0)
    my_test_equal(alphabet_position('b'), 1)
    my_test_equal(alphabet_position('y'), 24)
    my_test_equal(alphabet_position('z'), 25)
    my_test_equal(alphabet_position('Z'), 25)
    print()

    #  rotate_character(char, rot)

    print("Testing rotate_character(char, rot)...\n")
    my_test_equal(rotate_character('a', 13), 'n')
    my_test_equal(rotate_character('a', 14), 'o')
    my_test_equal(rotate_character('a', 0), 'a')
    my_test_equal(rotate_character('c', 26), 'c')
    my_test_equal(rotate_character('c', 27), 'd')
    my_test_equal(rotate_character('A', 13), 'N')
    my_test_equal(rotate_character('z', 1), 'a')
    my_test_equal(rotate_character('Z', 2), 'B')
    my_test_equal(rotate_character('z', 37), 'k')
    my_test_equal(rotate_character('!', 37), '!')
    my_test_equal(rotate_character('6', 13), '6')
    print()


    #  encrypt(text, rot)

    print("Testing encrypt(text, rot)...\n")
    my_test_equal(encrypt('a', 13), 'n')
    my_test_equal(encrypt('abcd', 13), 'nopq')
    my_test_equal(encrypt('LaunchCode', 13), 'YnhapuPbqr')
    my_test_equal(encrypt('LaunchCode', 1), 'MbvodiDpef')
    my_test_equal(encrypt('Hello, World!', 5), 'Mjqqt, Btwqi!')
    print()
Ejemplo n.º 16
0
def encrypt(text, rot):
    a = ''
    b = (int(rot))
    for i in text:
        a = a + (rotate_character(i, b))
    return a
Ejemplo n.º 17
0
def encrypt(text, rot):
    new_text = ""
    for char in text:
        new_text = new_text + rotate_character(char, rot)
    return new_text
Ejemplo n.º 18
0
def encrypt(text, rot):
    encrypt_text = ''
    for x in text:
        encrypt_text = encrypt_text + rotate_character(x, rot)
    return encrypt_text
Ejemplo n.º 19
0
def encrypt(text, rot):
    encrypted_text = ""
    for char in text:
        encrypted_text += rotate_character(char, rot)
    return encrypted_text
Ejemplo n.º 20
0
def encrypt(text, rot):
    new_string = []
    for i in text:
        new_string.append(helpers.rotate_character(i, rot))
    return "".join(new_string)
Ejemplo n.º 21
0
def encrypt(text, rot):
    new_string = ""
    for char in text:
        new_string += rotate_character(char, rot)
    return new_string
Ejemplo n.º 22
0
def rotate_string(text, rot):
    ''' This is the actual function that does the job! - more comment '''
    result = ''
    for c in text:
        result += rotate_character(c, rot)
    return result
Ejemplo n.º 23
0
from sys import argv, exit
print("I know that these are the words the user typed on the command line: ", argv)

from helpers import rotate_character
message = input("Enter your message: ")
rot = int(input("How much do you want to rotate by? "))

def user_input_is_valid(cl_args):
    if (str(cl_args).isdigit()):
        return True
    # elif (len(cl_args) < 2):
    #     return False
    else:
        return False
    exit()

def main():

    input_valid = user_input_is_valid(args[1])

    if input_valid == True:
        msg = input("Type a message: \n")
        return(rotate_character(msg, int(args[1])))
    else:
        return("Usage: python3 caesar.py n")

print(rotate_character(message, rot))
Ejemplo n.º 24
0
def encrypt(text, rot):
    encrypted_text = []
    for i in text:
        encrypted_text.append(rotate_character(i, rot))
    new_text = "".join(encrypted_text)
    return new_text
Ejemplo n.º 25
0
def encrypt(text, rot):
    encrypted_str = ''
    for i in range(len(text)):
        encrypted_str += rotate_character(text[i], rot)
    return encrypted_str
Ejemplo n.º 26
0
def encrypt(text, rot):
    list1 = ""
    for char in text:
        list1 += rotate_character(char, rot)
    return list1
Ejemplo n.º 27
0
def encrypt(text, rot):
    rotated_text = ''
    for char in text:
        rotated_text += rotate_character(char, rot)
    return rotated_text
Ejemplo n.º 28
0
def encrypt(text, rot):
    encryptText = ""
    for i in range(len(text)):
        temp = rotate_character(text[i], (rot % 13))
        encryptText = encryptText + temp
    return encryptText
Ejemplo n.º 29
0
def encrypt(text, rot):
    encode_text = ''
    for c in text:
        encode_text += rotate_character(c, rot)
    return encode_text
Ejemplo n.º 30
0
def rotate_string(text, rot):
    strRet = ""
    for c in text:
        strRet += rotate_character(c, rot)
    return strRet