Question
1. Please write the following in Python 3. Also, please show all output. Write a function that accepts the name of a file and returns
1. Please write the following in Python 3. Also, please show all output.
Write a function that accepts the name of a file and returns a tuple containing the number of lines, words, and characters that are in the file. (Hint: Use the split function of the string module to help you count the words in the file.)
Write a function that accepts an arbitrary number of lists and returns a single list with exactly one occurrence of each element that appears in any of the input lists.
Use the map function to add a constant to each element of a list. Perform the same operation using a list comprehension. For example, the list (1, 20, 300, 400) and constant 8, will result in: 9, 28, 308, 408
Write a function that will take a variable number of lists. Each list can contain any number of words. This function should return a dictionary where the words are the keys and the values are the total count of each word in all of the lists For example, if we are given the following lists: wl1 = ["double", "triple", "int", "quadruple"] wl2 = ["double", "home run"] wl3 = ["int", "double", "float"] the function should output the following dictionary (The order of the words is not important): {'float': 1, 'int': 2, 'quadruple': 1, 'home run': 1, 'triple': 1, 'double': 3} Note, you may have to create an empty dictionary first (for example: dict = {}).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started