Assume each of the variables set1 and set2 references a set. Write code that creates another set containing only the elements that are found in both set1 and set2, and assigns the resulting set to the variable set3.
set1 = [3, 5, 1, 2, 8]
set2 = [1, 3, 5, 7, 9]
set3 = []
for number in set1:
if number in set2:
set3.append(number)
print(set3)
So with this code, we loop through set1 and check to see if each number exists in set2, and if it does, we ‘append’ it to set3