title: how to terminate the program when similar elements are found
body: <p>I have the following 2D list:</p>
  <pre><code>test_list = [['A', 'B', 'C'], ['I', 'L', 'A', 'C', 'K', 'B'], ['J', 'I', 'A', 'B', 'C']]
  </code></pre>
  <p>I want to compare the 1st list elements of the 2D array <code>test_list[0]</code> with all other lists. If the elements <code>['A', 'B', 'C']</code> are present in all other lists then it should print any message such as &quot;All elements are similar&quot; and the program should terminate when it finds the above condition</p>
  <p>I have tried this piece of code but it only needs a termination condition: this is only a best-case scenario in which all elements are present.</p>
  <pre><code>test_list = [['A', 'B', 'C'], ['I', 'L', 'A', 'C', 'K', 'B'], ['J', 'I', 'A', 'B', 'C']]
  
  s = test_list[0]
  for e in test_list[1:]:
      if all(v in e for v in s):
          print(e, &quot;contains all elements of &quot;, s)
  
  #the program should terminate only if all the members are present.
  
  </code></pre>