Created
April 4, 2018 16:27
-
-
Save pitdeer/cbfaa1f4bb11a0405f42b45d750f9159 to your computer and use it in GitHub Desktop.
05_ListOVerlap
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
#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