Question: 1. Coding exercise on Python logical conditionals and strings Write a Python code that takes a nucleotide sequence, for example 'CATCGTCCT' and then it checks
1. Coding exercise on Python logical conditionals and strings
Write a Python code that takes a nucleotide sequence, for example 'CATCGTCCT' and then it checks if the sequence is shorter than 3 nucleotides and prints a warning to the user.
(Do you know what is the biological reason for this check? We cannot translate a DNA that is less than a triplet / codon to an amino acid (one amino acid corresponds to 3 DNA letters). Tip: this can be solved using a conditional that checks the length of the string, using the length of string functions)
2. Coding exercise on Python loops and strings
Write a Python Code that takes a sequence of nucleotides (use for example seq = ACGUUACGU) and examines whether it is a DNA or RNA molecule, and prints accordingly a message for the user. Remember that the difference between DNA and RNA is that the RNA has U instead of T.
(Tip: the way to solve this is to build a loop that iterates over each letter of the string, and check what that letter is, such as "for lettr in sampleStr:" and then inside the for loop have a condition that checks the content of the lettr variable)
3. Coding exercise on Python loops and strings
Start with the DNA sequence CATCGTCCT and write code that converts every nucleotide in sequence converts to lowercase, and if Thymine (T) is found, it is converted to Uracil (U). Essentially we are converting the DNA to RNA (the RNA has U instead of T), and it can be solved by writing a for Loop and substituting every letter to its lowercase counterpart, and also the T to U. You can also show how it can be done in one step, converting / substituting all letters using Python functions on strings (but you need to show a solution with the loop in order to get the points). Tip: The approach is similar to question no.2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
