title: How can I see if a list of tuples contains a specific tuple by knowing the values in this tuple?
body: <p>I am fairly new to python and therefore, although I have been trying to find a solution to this problem since hours, I cant! I have a list of tuples called <em>list_of_tuples</em> and then another list of tuples which is called <em>finalTuple</em>
  and to which I have appended two tuples. What I wanna do is read all of the tuples from the list_of_tuples and figure out if there is already an identical tuple in the list.
  If there is one I wanna print a message in the console which indicates that otherwise just append the tuple in the finalTuple. Could someone help me with that? I have tried the following code but it doesnt work:</p>
  
  <pre><code>list_of_tuples = [ ("a","b","c"),
      ("a","b","c"),
      ("a","b","d"),
       ("a","b","d"),
      ("i","k","l")
  ]
  
  first_tuple = ("a","b","c")
  second_tuple= ("a","b","d")
  finalTuple = []
  finalTuple.append(first_tuple)
  finalTuple.append(second_tuple)
  
  for i in range(len(list_of_tuples)):
     # print(listtt[i])
      if not(any((list_of_tuples[i]) in j for j in finalTuple)) :
         key_value = []
         key_value.append(list_of_tuples[i])
         finalTuple.append(tuple(key_value))
         print("The tuple is appended to the list")
      if (any((list_of_tuples[i]) in j for j in finalTuple)) :
         print("The value already exists")
  </code></pre>
  
  <p>The output I am getting on the console is:</p>
  
  <pre><code>PS C:\Users\andri\PythonProjects\mypyth&gt; py test.py
  The tuple is appended to the list
  The value already exists
  The value already exists
  The tuple is appended to the list
  The value already exists
  The value already exists
  The tuple is appended to the list
  The value already exists
  </code></pre>