Skip to content

Instantly share code, notes, and snippets.

@Wingless-Archangel
Created November 5, 2016 07:41
Show Gist options
  • Save Wingless-Archangel/eb14b913810962a1b9070ae1adf83236 to your computer and use it in GitHub Desktop.
Save Wingless-Archangel/eb14b913810962a1b9070ae1adf83236 to your computer and use it in GitHub Desktop.
return the list of element that exists in 2 list
#!/usr/bin/python3
def main():
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]
ans = list(set([num for num in a if num in a and num in b]))
print(ans)
if __name__ =='__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment