Explain ! Intermediate Algorithm Scripting: DNA Pairing

having a hard time understanding this question,can someone explain this

Hey @Advitya-sharma,

  • Next time if you need a help from a challenge, you can use the Get Help button on the sidebar.

    It makes it easier for everyone to see your code and the challenge.
  • The problem here is that we don’t know if you tried anything, we don’t know what you already know.
1 Like

oh this is cool,I’ll take care next time

I don’t know if you already learned this or not, but in Biology, base pairs in DNA are pairs of bases. There are 4 bases in our DNA, Cytosine (C), Guanine (G), Adenine (A), and Thymine (T). The challenge also links it to an information about base pairs. In the base pairing rule, Cytosine goes with Guanine, and Adenine goes with Thymine. So the challenge wants you to make the pair for each one of them. Example if the given bases are CGTTC, then the pairs are GCAAG. This challenge is using the Biology Base Pairing Rule.

1 Like

Ok, then, in the DNA you have 4 bases, A, T, C, and G, and A and T are always paired together, and C and G are always paired together

You get a string of bases as an imput, for example ATTCG, and you need to give back the couples corresponding for each one in an array of arrays, so this one would become: [['A', T'], ['T', 'A'], ['T', 'A'], ['C', 'G'], ['G', 'C']]

2 Likes

in pairElement(“TTGAG”)
there is no C but the result contains [G,C]
how ?

Yes, because there is a G. and as I explained it, G pairs with C. @ilenia, also explained this well with examples.

1 Like

You have TTGAG as input
you need to give back an array of arrays:

  • the first character is T, T is coupled with A, so the first inner array should be ['T', 'A']
  • the second character is T, T is coupled with A, so the second inner array should be ['T', 'A']
  • the third character is G, G is coupled with C, so the third inner array should be ['G', 'C']
  • the fourth character is A, A is coupled with T, so the fourth inner array should be ['A', 'T']
  • the fifth character is G, G is coupled with C, so the fifthinner array should be ['G', 'C']

so your output should be [['T', 'A'], ['T', 'A'], ['G', 'C'], ['A', 'T'], ['G', 'C']]

2 Likes

@Catalactics @ilenia thanks ,this was easy.

1 Like

now the difficult part will be writing the code

happy coding!

haha ,I was talking about code.

2 Likes