Skip to content

Instantly share code, notes, and snippets.

@shamikalashawn
Created February 2, 2017 23:10
Show Gist options
  • Save shamikalashawn/40e5b804c4f8eddd52a8f704b8b16ec5 to your computer and use it in GitHub Desktop.
Save shamikalashawn/40e5b804c4f8eddd52a8f704b8b16ec5 to your computer and use it in GitHub Desktop.
When provided with two tuples, a set is returned with the common elements found in each tuple.
def common_values(tuple1, tuple2):
if type(tuple1) != tuple or type(tuple2) != tuple:
return "Params not of type 'tuple'"
else:
set1 = set(tuple1)
set2 = set(tuple2)
return set1.union(set2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment