Computer Science Canada replacing certain characters with others, and translating strings |
Author: | rprezi [ Mon Nov 27, 2017 9:32 am ] | ||
Post subject: | replacing certain characters with others, and translating strings | ||
What is it you are trying to achieve? I am trying to make it so if a person, for instance, inputs a DNA strand, such as GTA,ACC,GCG My "DNA-RNA translator will output the corresponding RNA strand (in this instance, GUA,ACC,GCG) Essentially, I'd like for the user's input to come out the same, except with all Ts being translated to Us. I'm very new to coding, and Turing seems like a good place to start learning. Is there some command I can use to solve this problem? As a side note, i'm also looking to translate RNA strands into amino acid names, which would be a similar problem, for instance an RNA input of GUA,ACC,GCG would output "valine,threonine,alanine" How could I program the translation of specific 3 letter combinations into amino acids? Here is my code I have written so far, for reference I know there is probably an easier way to write it, but this is what I have. Thanks so much, Rory Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Please specify what version of Turing you are using Turing 4.1.1 |
Author: | TokenHerbz [ Tue Dec 05, 2017 10:54 pm ] | ||||||
Post subject: | RE:replacing certain characters with others, and translating strings | ||||||
you want to look up case statements and heres an example.
also head over to the walkthrough and check out string manipulation, thats where you'll find your answer. and for your first question, just look through the indexes of the string for the pattern you wish to identify then rebuild that string to use. look up index for ideas http://compsci.ca/holtsoft/doc/
|