Created
February 2, 2017 23:10
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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