DNA is a biomolecule that carries genetic information. It is composed of four different building blocks, called nucleotides: adenine (A), thymine (T), cytosine (C) and guanine (G). Two DNA strands join to form a double helix, whereby the nucleotides of one strand bond to the nucleotides of the other strand at the corresponding positions. The bonding is only possible if the nucleotides are complementary: A always pairs with T, and C always pairs with G.

Due to the asymmetry of the DNA, every DNA strand has a direction associated with it. The two strands of the double helix run in opposite directions to each other, which we refer to as the 'up-down' and the 'down-up' directions.

Write a function `checkDNA` that takes in two DNA sequences as strings, and checks if they are fit to form a fully complementary DNA double helix. The function should return a Boolean `true` if they are complementary, and `false` if there is a sequence mismatch (Example 1 below).

Note:

- All sequences will be of non-zero length, and consisting only of `A`, `T`, `C` and `G` characters.
- All sequences **will be given in the up-down direction**.
- The two sequences to be compared can be of different length. If this is the case and one strand is entirely bonded by the other, and there is no sequence mismatch between the two (Example 2 below), your function should still return `true`.
- If both strands are only partially bonded (Example 3 below), the function should return `false`.

Example 1:

Example 2:

Example 3:

---
#### If you enjoyed this kata, check out also my other DNA kata: [**Longest Repeated DNA Motif**](http://www.codewars.com/kata/longest-repeated-dna-motif)

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def check_DNA(seq1, seq2):
	

Solutions:
def check_DNA(seq1, seq2):
	if len(seq1) < len(seq2):
		(seq1, seq2) = (seq2, seq1)
	seq2 = seq2[::-1].replace('C', 'g').replace('G', 'c').replace('T', 'a').replace('A', 't').upper()
	return seq1.find(seq2) >= 0


table = str.maketrans('ACGT', 'TGCA')

def check_DNA(seq1, seq2):
	(seq1, seq2) = sorted((seq1, seq2), key=len)
	return seq1 in seq2[::-1].translate(table)


trans = str.maketrans('ATCG', 'TAGC')

def check_DNA(seq1, seq2):
	(seq1, seq2) = sorted((seq1, seq2), key=len)
	return seq1[::-1].translate(trans) in seq2


def check_DNA(s1, s2):
	s2 = s2[::-1].translate(str.maketrans('ATCG', 'TAGC'))
	return s1 in s2 or s2 in s1