Q:

Write a Python function that takes two lists and returns True if they have at least one common member

0

 Write a Python function that takes two lists and returns True if they have at least one common member

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

def common_data(list1, list2):
     result = False
     for x in list1:
         for y in list2:
             if x == y:
                 result = True
                 return result
print(common_data([1,2,3,4,5], [5,6,7,8,9]))
print(common_data([1,2,3,4,5], [6,7,8,9]))

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now