Created
September 18, 2020 16:17
-
-
Save timeowilliams/7b313130ac2e95d8824d2283921a3a2a to your computer and use it in GitHub Desktop.
Practice Python 5: List Comparison
This file contains 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
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] | |
lena = len(a) - 1 | |
lenb = len(b) - 1 | |
i = 0 | |
share = [] | |
while lena != 0 and lenb != 0: | |
if a[i] in b and a[i] not in share: | |
share.append(a[i]) | |
lena -= 1 | |
lenb -= 1 | |
i += 1 | |
print(share) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment