please code in python. Each problem will be placed in its own function. You will have a main function that calls the function for each problem. For these problems, you will need to use the following string functions: lower, upper, isupper, islower, isdigit, and replace, along with using [ ] to access individual characters. You may use other string functions if you find them useful. You will write a function named computeGCPercentage that accepts a string (representing a piece of DNA) as an input and returns a float representing the Guanine-Cytosine (GC) content percentage. For example, assume that the DNA string GTAACTAGCTTACGTAAC is entered. Because there are a total of 7 characters that are either G or C, and there are 18 characters altogether, the function should return a floating point value equivalent to 7/18 . Requirements Your function: 1. Must check to see that there are no other characters in the string other than those specified. If there is, it should print an error message and return 0. 2. Must check to make sure that the string actually has characters. If it is a zero-length string, return 0. 3. Must work correctly for both upper-case, lower-case, and mixed-case strings.
please code in python.
Each problem will be placed in its own function. You will have a main function that calls the function for each problem. For these problems, you will need to use the following string functions: lower, upper, isupper, islower, isdigit, and replace, along with using [ ] to access individual characters. You may use other string functions if you find them useful.
You will write a function named computeGCPercentage that accepts a string (representing a piece of DNA) as an input and returns a float representing the Guanine-Cytosine (GC) content percentage.
For example, assume that the DNA string GTAACTAGCTTACGTAAC is entered. Because there are a total of 7 characters that are either G or C, and there are 18 characters altogether, the function should return a floating point value equivalent to 7/18 .
Requirements Your function:
1. Must check to see that there are no other characters in the string other than those specified. If there is, it should print an error message and return 0.
2. Must check to make sure that the string actually has characters. If it is a zero-length string, return 0.
3. Must work correctly for both upper-case, lower-case, and mixed-case strings.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images