Labs Week of February 12

  1. Write a function len_div_3 that has one parameter - string of characters. If the length of the string is divisible by 3 the function returns True, otherwise the function returns False

    Write main that first reads the number of strings in the list and, creates a list of strings (use function make_list_string we wrote already. The program creates a new list that includes strings with length divisible by 3. The program also outputs the size of the new list

    Example: ["Yana", "Bob", "apple", "python"]
    new_list=["Bob", "python"]

  2. Write a function change that has one parameter - string of characters. The function returns a new string in which all lower case chars are replaced with corresponding upper case and vise versa.

    Write main that first reads the number of strings in the list and, creates a list of strings (use function make_list_string we wrote already. The program changes each string in the list using function change. Store new strings in the new list and print it at the end of the program.

    Example: ["Yana", "Bob", "apple", "PyThoN", "For"]
    new_list=["yANA", "bOB", "APPLE", "pYtHOn", "fOR"]

  3. Write a function count_sign that has one parameter - string, the function counts and returns the number of '+' and '-' in the string

    Write main that first reads the number of strings in the list and, creates a list of strings (use function make_list_string we wrote already. The program uses function count_sign to count the number of '+' and '-' signs in each string. The program creates a list of integers that holds counters. Thr program finds the string with max and min number of signs.

  4. Caser Cipher encrypts strings of letters by replacing each letter with the letter located 3 places forward in the alphabet. The decrypion process works backwards - each letter is replaced with the letter located 3 letters backwards. Write a function encrypt_letter that has one parameter - ONE letter. The function returns the encrypted letter.

    Write a function decrypt_letter that has one parameter - ONE letter. The function returns the decrypted letter.

    Write main to test your function.

  5. Use the function witten above to encrypt and decrypt the whole string.