Skip to content

Instantly share code, notes, and snippets.

@pitdeer
Created April 4, 2018 16:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pitdeer/cbfaa1f4bb11a0405f42b45d750f9159 to your computer and use it in GitHub Desktop.
Save pitdeer/cbfaa1f4bb11a0405f42b45d750f9159 to your computer and use it in GitHub Desktop.
05_ListOVerlap
#Take two lists and write a program that returns a list
#that contains only the elements that are common between the lists (without duplicates).
#Make sure your program works on two lists of different sizes.
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]
c = []
for tab in range(a, b):
for i in range(0, len[tab]):
if not a[i] in c:
c.append(tab[i])
print(c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment