+ 1
Question about lists in python...
Hey there! I have a question for you... If I have 2 lists... Example: A = [1,2,3,4,5,6] B = [1,4,9,16,25] how can I write a program that tells me in there is at least 1 element of A in B? Also another thing... If I have a lists of divisors of a number, how can I exclude 1 and the number itself from the list? Thank a lot to everyone!
3 Réponses
+ 5
Without using sets you can do that using loops.
if any(i in B for i in A): print("The list B has atleast one item from the list A.")
+ 2
Thanks to both of you!