Skip to content

Instantly share code, notes, and snippets.

@battez
Created June 19, 2018 14:57
Show Gist options
  • Save battez/56d81548519a039cc29b8b618fe67de2 to your computer and use it in GitHub Desktop.
Save battez/56d81548519a039cc29b8b618fe67de2 to your computer and use it in GitHub Desktop.
py practice ex05
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
def common_items(list_a, list_b):
result = set()
for item in list_a:
if item in list_b:
result.add(item)
return list(result)
print(common_items(a, b))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment