1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
oee [108]
3 years ago
12

1. Write a program to prompt the user to enter a single character and respond back whether or not the character is valid dna. 2.

Write a program to prompt the user to enter a single character and respond back whether or not the character is valid rna. 3. Write a program to prompt the user to enter a dna sequence and respond back whether or not the sequence is valid. 4. Write a program to prompt the user to enter a rna sequence and respond back whether or not the sequence is valid.
Computers and Technology
1 answer:
Nina [5.8K]3 years ago
7 0

Answer:

Answer 1:

dna = input("Enter DNA type: ")

dna = dna.upper()

print(dna)

if dna == "A" or dna == "B" or dna == "Z":

   print("valid")

else:

   print("invalid")

Answer 2:

rna = input("Enter DNA type: ")

rna = rna.lower()

print(rna)

if rna == "m" or rna == "t" or rna == "r":

   print("valid")

else:

   print("invalid")

Answer 3:

dnaSquence = input("Enter the DNA sequence: ")

type = "valid"

for char in dnaSquence:

   if char not in ["A", "C", "G", "T"]:

       type = "invalid"

       break

print(type)

Answer 4:

rnaSquence = input("Enter the RNA sequence: ")

type = "valid"

for char in rnaSquence:

   if char not in ["A", "C", "G", "U"]:

       type = "invalid"

       break

print("valid")

Explanation:

There are three types of DNA; Type A, Type B and Type Z.

A DNA sequence consists of; A, C, G and T.

There are three types of RNA; mRNA, tRNA and rRNA.

An RNA sequence consists of; A, C, G and U.

Code Explanations:

Code 1:

dna = input("Enter DNA type: ")

dna = dna.upper()

print(dna)

if dna == "A" or dna == "B" or dna == "Z":

   print("valid")

else:

<em>    print("invalid")</em>

  1. prompts and Takes a single character input
  2. converts the character to upper case
  3. compares the input to the DNA types
  4. Prints "valid" for a valid input else prints "invalid"

Code 2:

rna = input("Enter DNA type: ")

rna = rna.lower()

print(rna)

if rna == "m" or rna == "t" or rna == "r":

   print("valid")

else:

<em>    print("invalid")</em>

<em />

  1. prompts and Takes a single character input
  2. converts the character to lower case
  3. compares the input to the RNA types
  4. Prints "valid" for a valid input else prints "invalid"

Code 3:

Answer 3:

dnaSquence = input("Enter the DNA sequence: ")

type = "valid"

for char in dnaSquence:

   if char not in ["A", "C", "G", "T"]:

       type = "invalid"

       break

print(type)

  1. It prompts for a DNA sequence.
  2. Declares a string variable "type" and initializes type to valid.
  3. The FOR loop checks every character in the DNA sequence.
  4. If the character is not in the list [A, C, G, T] type becomes invalid and the loop breaks and the type "invalid" is printed to the screen.
  5. if all the characters are in the list, then type will remain valid and will be printed to the screen.

Code 4:

rnaSquence = input("Enter the RNA sequence: ")

type = "valid"

for char in rnaSquence:

   if char not in ["A", "C", "G", "U"]:

       type = "invalid"

       break

print("valid")

  1. It prompts for a RNA sequence.
  2. Declares a string variable "type" and initializes type to valid.
  3. The FOR loop checks every character in the RNA sequence.
  4. If the character is not in the list [A, C, G, U] type becomes invalid and the loop breaks and the type "invalid" is printed to the screen.
  5. if all the characters are in the list, then type will remain valid and will be printed to the screen.

You might be interested in
If you were practicing keyboarding and the exercise contained the letters j, k, l, m, n, and b, what section of the
Stella [2.4K]
The answer is left.
5 0
2 years ago
Please tell fast plzzzzzzzzzzz.​
kumpel [21]

Answer:

9

Explanation:

1×2^3+0+0+1×2^0

8+1=9

6 0
2 years ago
When excel imports an access table, the data is placed in a worksheet _____?
ratelena [41]
Book is the answer!!!!!
3 0
3 years ago
What is the output of the following C++ program?
KIM [24]

Answer:

Output:<em> </em><em>15 11/16 inches</em>

Explanation:

#include <iostream>

using namespace std;

////////////////////////////////////////////////////////////////////////

class InchSize {

public:

   InchSize(int wholeInches = 0, int sixteenths = 0);

   void Print() const;

   InchSize operator+(InchSize rhs);

   

private:

   int inches;

   int sixteenths;

};

InchSize InchSize::operator+(InchSize rhs) {

   InchSize totalSize;

   totalSize.inches = inches + rhs.inches;

   totalSize.sixteenths = sixteenths + rhs.sixteenths;

   

   // If sixteenths is greater than an inch, carry 1 to inches.

   if (totalSize.sixteenths >= 16) {

       totalSize.inches += 1;

       totalSize.sixteenths -= 16;

   }

   return totalSize;

}

InchSize::InchSize(int wholeInches, int sixteenthsOfInch) {

   inches = wholeInches;

   sixteenths = sixteenthsOfInch;

}

void InchSize::Print() const {

   cout<<inches<<" "<<sixteenths<<"/16 inches"<<endl;

}

////////////////////////////////////////////////////////////////////////

int main() {

   InchSize size1(5, 13);

   InchSize size2(9, 14);

   InchSize sumSize;

   sumSize = size1 + size2;

   sumSize.Print();

   return 0;

}

////////////////////////////////////////////////////////////////////////

sumSize variable was printed in the end. Print() prints the calling object's inches and sixteenths variables' values.

sumSize's inches is equal to size1 plus size2's inches.

Because the sum of sixteenths was greater than 16, sumSize's sixteenth was decreased by 1 and inches was increased by 1.

3 0
3 years ago
¿Cuál es la influencia de las redes sociales en casa?
Natalka [10]
La influencia de las redes sociales en la casa puede variar. Primero puede ser bueno porque podemos usar las redes sociales para ver recetas de cocina para hacer en casa. Segundo puede ser malo porque las personas de la casa podrían sufrir acoso cibernético .
3 0
3 years ago
Other questions:
  • The internet is an example of
    12·2 answers
  • Dr. Laos gets a referral for a 6 month old who has become listless and stopped eating lately. Her pediatrician wanted her to be
    15·1 answer
  • What are two most common types of microcomputers? a. IBM-style PCs and Macs c. Clients and Servers b. Mainframes and Minicompute
    14·1 answer
  • I prefer a job where I am praise for good performance or I am accountable for results
    13·1 answer
  • I need help with writing the code in Python that draws an arrow pointing to the right.
    15·1 answer
  • If you are a mathematics student and want to study the secret of writing cryptographic codes, algorithms, encryption and decrypt
    14·1 answer
  • If we ignore the audio data in a video file, a video file is just a collection of many individual frames (i.e., images). What is
    6·1 answer
  • The __Option carries out the commands one at a time. O Step-by-Step Run Command Open Command​
    9·1 answer
  • Which software development method uses highly skilled programmers to shorten the development process while producing quality sof
    9·1 answer
  • Which of the following could be a method for an object-oriented class called Student?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!