Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MFDBS 89 2nd Symposium On Mathematical Fundamentals Of Database Systems Visegrad Hungary June 26 30 1989 Proceedings

Authors: Janos Demetrovics ,Bernhard Thalheim

1989th Edition

3540512519, 978-3540512516

More Books

Students also viewed these Databases questions