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
The Bradshaw family has $200,000 of total assets and $140,000 of liabilities. What is their net worth?
3241004551 [841]

Answer:

$340,000 is there net worth

Explanation:

$200,000+ $140,000 = $340,000

5 0
3 years ago
Write a program that accepts a whole number as
SashulF [63]

This is for Python

number = int(input('Number: '))

number = number * 12

print(number)

3 0
2 years ago
What happens when your project is rendered?
jok3333 [9.3K]

Answer:

B

Explanation:

when your rendering video project your computer is processing all the data that goes into creating images you experience video rendering every time you look at your computer the images on your screen has all been rendered to produce the website photo or video you are looking at

4 0
2 years ago
(15 POINTS + BRAINLIEST) My friend is trying to make an account on brainly, but she can't sign in. All it just says is, “We cann
julia-pushkina [17]
Try a different email and see if that works :)
5 0
3 years ago
Read 2 more answers
What is java programing <br>​
sesenic [268]

Answer:

Explanation:

Java is a class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible. ... Java applications are typically compiled to bytecode that can run on any Java virtual machine (JVM) regardless of the underlying computer architecture

8 0
3 years ago
Read 2 more answers
Other questions:
  • High Frequency Traders are
    5·1 answer
  • <img src="https://tex.z-dn.net/?f=6.372%20%5Ctimes%2075%20find%20the%20product" id="TexFormula1" title="6.372 \times 75 find the
    6·1 answer
  • HURRRYYYY PLZZ!!
    13·2 answers
  • How can the use of new technology in industry benefit the us government
    8·2 answers
  • A computer virus is a program that can copy itself and infect a computer without the permission of the owner. How do you think a
    9·1 answer
  • Percentage-wise, which renewable energy source is used most?
    13·1 answer
  • What effect would excluding quotation marks from a search phrase have?
    12·1 answer
  • What is a function of Agile software development?<br>​
    7·1 answer
  • You enter information by keying it into the??​
    8·2 answers
  • Who is the intended audience of a pseudocode document?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!