Labs January 18 - 23

  1. Write a function def make_that has one parameter - string of characters. The function creates and returns FOUR new strings 1) the string of all lower case letters in the original string; 2) the string of all upper case letters in the original string; 3) the string of all digits in the original string; 4) the string of all other characters that are not letters or digits Write main to test your function.

  2. Write a function def pig_latin(my_str) that accepts one parameter - string of characters and returns new string based on the rules of Pig Latin slightly different that described in the book: The LAST character of the string is removed and placed at the BEGINNING of the string and the string "ay" appended to the original string. For example, if the original string is "dog", then the modified string will be: "gdoay"

    Write a function def fchange_list(string_list) that accepts one parameter - list of strings. The function converts each string to Pig Latin using function you wrote above and creates and returns a new list of Pig Latin strings. For example, if the original list was ["yana", "guy", "I"] Then the Pig Latin list will be: ["ayanay", "yguay", "Iay"]

    Write main to test your functions

  3. Write a function change that has one parameter - string of characters. The function renoves all digits from the original string and returns the new string without any digits. Pay attention: since Python cannot change the original string, you need to create a new string and copy all non-digit chars from the original string to the new one and then return a new string.

    Write a program that generates the list of strings and for each string removes all its digits. The program prints updated listed at the end

  4. Write a function compare that has two parameters - two strings. If the strings are not of the same size, the function returns -1, otherwise, the function finds and returns the number of matching characters on the same position.

    Write a program that generates the list of strings, and for each pair finds the number of matching characters

  5. In this problem, we rearrange the letters within the word. The first and last letters of the word are unchanged, and the letters in the rest of the word are reversed. For example, the word "Widener", become "Wenedir", the word "University", become become "Utisreviny". Write a program that generates a list of words(strings), and prints the list of transformed words. For example, if the list of strings is:
    Today, I, am, writing, lots, of, fun, programs

    the output should be:
    Tadoy, I, am, wnitirg, ltos, of, fun, pmargors