Lab 5

Solve all problems. Choose one you will submit for the graded assignment part. Only one program is required for the graded part, the rest is count as practice

  1. Write a program that reads a number of family members, names of all family members, and the number of hours they spend on Facebook per day. Store family names in the list of strings, and Facebook hours in the list of integers.

    The program finds the family member spending the most amount of time on Facebook per day, finds the total number of hours all family spend on Facebook per day, and average number of hours per family. Try to apply the top down design and write appropriate functions for each task.

  2. 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

  3. 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

  4. 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