Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

No chatgpt, no AI please : Write a function named get _ common _ elements that accepts two lists as parameters. The function will return

No chatgpt, no AI please : Write a function named get_common_elements that accepts two lists as parameters.
The function will return a new list of all elements that are common to both lists. The
new list should not have any duplicate values in it (only unique values). Note that the
lists don't need to be the same length, and one or both could be empty lists.
Example Executions
alist =[]
blist =[]
print(get_common_elements(alist, blist)) # prints []
alist =[]
blist =[1]
print(get_common_elements(alist, blist)) # prints []
alist =[1,3,5]
blist =[1,5]
print(get_common_elements(alist, blist)) # prints [1,5]
alist =[1,3,5]
blist =[2,4,6]
print(get_common_elements(alist, blist)) # prints []
alist =[9,7,2,4,6,8,12,0,9]
blist =[2,4,0,9,1,7,4]
print(get_common_elements(alist, blist))# prints [9,7,2,4,0]

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

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

13th Edition Global Edition

1292263350, 978-1292263359

More Books

Students also viewed these Databases questions

Question

What is organizational flattening? Why is it practiced?

Answered: 1 week ago