How should this be completed.
1. Write the following function (with comments but no screenshot of the execution) def letters(str1) that takes a string argument str1 and returns a set of only letters ("a-z" and "A-Z") that are contained in the string. 5 pts a) Your code with comments 2. Write the following function and provide a program to test it (main and function in one .py) def lettersInBoth(str1, str2) that takes two string argumentsstr1, str2 and returns a set consisting of the upper and lower case letters that are contained in both strings. Use the function letters(str1), from question 1, to turn the letters into sets (Use intersect). 5 pts a) Your code with comments b) A screenshot of the execution Test Case: Enter string 1: abcdef1 Enter string 2: abc3 The set that is in both is: {'a', 'b', 'c'} 3. Write the following function and provide a program to test it (main and function in one .pw) def notinEither(str1, str2) that takes two string arguments str1, str2 and returns a set consisting of the lower case letters that are NOT contained in both strings. Use the function letters(str1), from question 1, to turn the letters into sets. (Use difference). 5 pts a) Your code with comments b) A screenshot of the execution Test Case: Enter string 1: abcdefg4 Enter string2: hijkimnopqurs5 The set of lowercase letters not in either is {w', 't', 'y', 'x', 'v', 'z'} 4. Given a dictionary grade Counts = {"A": 8, "D": 3, "B": 15, "F": 2, "C": 6} write the Python statement(s) to print: 5 pts A) all the keys all the values C) all the key and value pairs D) A screenshot of the execution5. Write a program that counts how often each word occurs in a text file. Enter a file name, put the words (using split) into a dictionary, then prints each word and how many times it was used. Hint: the word is the key and the count is the value. 5 pts a) Your code with comments b) A screenshot of the execution c) A copy of the text file 6. A useful application for a dictionary is to remember, or cache, previously obtained results so that they can be retrieved from the cache when they are new. Modify the program in problem #5 above so that the user can repeatedly enter filenames. If the user enters the same filename more than once, look up the answer from a dictionary instead of counting the words again (print the message "filename already entered"). In either case, print the dictionary. For example the two dictionaries would contain, 5 pts Cache = {filename1 dictionary1, filename2:dictionary2, ...} Counts = {word1:count1, word2:count2, ...} a) Your code with comments b) A screenshot of the execution c) A copy of the text file