Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Solution: DNA sequencing using regex

import re
from dna_sequencing import get_sequences


if __name__ == '__main__':
    dna = 'ACCGXXTXXYYGTTQRACQQTGGGCXTTGTXX'

    dna = re.sub(r'[^ACTGX]+', 'X', dna)

    short_sequences = get_sequences(dna)
    print(short_sequences)