Python - checking if phrase appears on a list
Clarifying terms makes both code and documentation easier to understand.  You use the word "phrase" (which usually refers to an arbitrary group of words) to refer to both a line (one of a set of linebreak-delimited strings) and a word (one of a set of whitespace-delimited strings).  If you're talking about a single word, say "word".  :)
Give your function a descriptive name!  Maybe has_unique_words?
Type annotations and a docstring also make functions easier to understand.


Here's what we've got so far:

def has_unique_words(phrase: str) -&gt; bool:
    """Checks whether any (whitespace-delimited) words in the phrase are repeated.
    Returns True only if all words are unique."""
    words = phrase.split()



Mutating an iterable as you iterate over it is an easy way to confuse yourself, and it's usually better to iterate over the elements of an list rather than the range of its indices (although because you're mutating it that might not work well here).  It might be better to find a solution that doesn't involve mutating the list.  Here are a few possibilities that are all simpler alternatives to popping/searching/re-inserting:


# Count the number of occurrences of each word.
# If each occurs exactly once, all words are unique.
word_counts: Dict[str, int] = defaultdict(int)
for word in words:
    word_counts[word] += 1
return all(count == 1 for count in word_counts.values())


# Iterate through each word and check whether we've already seen it.
seen_words: Set[str] = set()  # this could be a list, but a set is faster to check
for word in words:
    if word in seen_words:
        return False
    seen_words.add(word)
return True


This one-line check is what I would do:

# Build a set (which guarantees uniqueness) out of the list of words.
# If the number of elements is the same, all the list elements are unique.
return len(set(words)) == len(words)



In the interest of brevity I'd use sum and a comprehension to build the count rather than a named variable:


with open('file_with_phrases.txt', 'r') as file:
    print(sum(1 for line in file if has_unique_words(line)))