Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In python 1. (Lists) Write the function remove duplicates(L) that receives a list L and returns a new list with all duplicated elements removed. 2.

In python

image text in transcribed

1. (Lists) Write the function remove duplicates(L) that receives a list L and returns a new list with all duplicated elements removed. 2. (Arrays) Write the function sum rows(A) that receives a2D array A and returns a 1D array containing the sum of each row of A. 3. (Sets) Write the function common elements (L1,L2) that receives two lists L1 and L2 and returns a set containing the elements that appear in both L1 and L2. (Dictionaries) Write the function frequency of words(S) that receives a string S and returns a dictionary containing the frequency of each word in S. 4. (Lists) Write the function merge(L1, L2) that receives two sorted lists L1 and L2 and returns a new sorted list containing all elements from both L1 and L2. 5. (Arrays) Write the function average diagonals(A) that receives a 2D array A and returns the average of the elements in the two main diagonals of A. 6. (Sets) Write the function unique elements( L) that receives a list L and returns a set containing the unique elements of L. 7. (Dictionaries) Write the function word count(S) that receives a string S and returns a dictionary containing the count of each word in S. 8. (Lists) Write the function split (L,k) that receives a list L and an integer k and returns two new lists, one containing the first k elements of L and the other containing the rest of the elements. 9. (Arrays) Write the function sum columns(A) that receives a 2D array A and returns a 1D array containing the sum of each column of A. 10. (Sets) Write the function disjoint sets(L1, L2) that receives two sets L1 and L2 and returns True if they are disjoint (have no elements in common) and False otherwise. 11. (Dictionaries) Write the function reverse lookup(D, v) that receives a dictionary D and a value v and returns a list of all keys in D that map to v

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions