- 1
I have some problem in my code. Please help! How I can fix it?
I want to change the DNA codes to RNA code but the problem is when the wanted gen code entered correctly, there is no output. (All explanations are written in the code.) https://code.sololearn.com/c47FMyr0Tfsg/?ref=app
2 Respuestas
+ 4
When replacing 'T' for 'U', you only increment 'i' if the current character is a 'T', creating an infinite loop if the current character is something else. Move the increment after the conditional instead.
By the way, I'm not sure what the purpose of the outer loop is, seeing that you break from it anyway in the first iteration. If you want to validate the sequence while replacing 'T', you could do something like this:
https://code.sololearn.com/cIiK824kma2J/?ref=app
- 1
Thanks Shadow :)