def intersect(seq1, seq2): res = [] # start empty for x in seq1: # scan seq1 if x in seq2: # common item? res.append(x) # add to end return res x = intersect([1, 2, 3], (1, 4)) # mixed types print x # saved result object