Professional Documents
Culture Documents
Quiz5 cs104 Solutions-Lms
Quiz5 cs104 Solutions-Lms
Student Number:
CS 104 – Spring 2022
QUIZ 5
1. (50pts) Write a Python program that compares two lists and finds the different
unique elements in these lists. The result should be stored in the list as well. You
can assume the given lists are:
list1 = [1,5,7,9,19,21,6, 2, 7]
list2 = [2,3,5,6,12,7,1]
list1 = [1,5,7,9,19,21,6, 2, 7]
list2 = [2,3,5,6,12,7,1]
uniqueList = []
print(uniqueList)
2. (50pts) Write a function which takes a value and returns whether that
value is in the gray zone or not for the given two sets below:
A = { 2, 3, 4, 5, 6, 7, 8}
B = {7, 8, 9, 10}
def setFunc(value):
A = set([2, 3, 4, 5, 6, 7, 8])
B = set([7, 8, 9, 10])
return value not in (A | B) - (A & B)