need help with a homework question filter through file and select lines composed of six letters and write the result to a file

Need a little help here. I am filtering through a large file and select lines composed of six letters and write the result to a file (.fasta format). I attached the question, input file and my code with this post.

Question:

write a program named bp_kmers.pythat does the following:

  • Reads the Drosophila genome file
  • Finds the k-mers of length 6 within each chromosome
  • Prints the k-mers that occur only once to a FASTA file namedkmers.fasta