Question: Exercise 3 Create a function that accepts a list of words/strings as its positional argument. The function should count the occurances of each word and


Exercise 3 Create a function that accepts a list of words/strings as its positional argument. The function should count the occurances of each word and return the most frequent word in the collection. In the case of a tie, return a list of the most frequent words. [ ]: # your function definition here [ ]: # your tests here Repeat exercise 3 using multiple arguments to provide the words instead of a list. [ ]: # your function definition here [ ]: # your tests here Exercise 4 Define another function to approximate using the following equation. Again, your function should accept a single integer argument (n) which controls the number of iterations/terms in the summation. = ** V12+ ] 2k + 1 k=1 Test your function definition with a variety of n values. [ ]: # your function definition here [ ]: # your tests here Exercise 5 Write a function that computes the following: (-1)+1 r? * x = x + x+ +... = In(1 + x) 2 3 This function should have one parameter (n) and return the computed value which should approximate In(1 + x). 1: ## your function definition here : ## your tests here Exercise 6 Define and test a python function to derive all possible pairings of numbers from the sequence of a given range defined by n. For example, if n is 3... the sequence of numbers will be [0, 1, 2]. So we generate a list of 2-tuples for each pair: [(0,0), (0,1),(0,2), (1,0), (1,1),(1,2), (2.0), (2,1),(22)]. A nested for-loop works nicely here However, we need to filter out "twin" pairs of the same number such as (0,0), (1,1), and (2,2). Moreover, (0,1) and (1,0) are reverse pairings. Redundant. We only need one. So we should retain only the (0.1) and remove the redundant reverse pairing Your function should accept the parameter n. Generate all possible tuple pairs. Filter out twin pairs (xh) where x=y. Filter out reverse pairs (for (0,1) remove (1,0) as an example). This leaves our final answer list of tuples: [(0,1),(0,2), (1,2) ] which your function should return. 1: ## your pairing definition here |: ## your tests here
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
