In python if a variable has a value if will return True, using not inverses the result.
The variable "is_not_dna" is being set as a bool when you use the "not" before the d_n_a in the following line. "is_not_dna = not d_n_a"
If you are wanting to compare values I would recommend looking into sets or list comprehensions.
As a note it is easier to read and understand the question if the code snippet is formatted correctly rather than squashed into one line.