Skip to content

Instantly share code, notes, and snippets.

@timeowilliams
Created September 18, 2020 16:17
Show Gist options
  • Save timeowilliams/7b313130ac2e95d8824d2283921a3a2a to your computer and use it in GitHub Desktop.
Save timeowilliams/7b313130ac2e95d8824d2283921a3a2a to your computer and use it in GitHub Desktop.
Practice Python 5: List Comparison
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