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
What can a government use to determine your location at a specific time as long as you're using your mobile device
Ugo [173]
I don’t know if I 100% understand the question… But GPS/ Geotracking can be used to track your device at specific times
6 0
2 years ago
A laptop computer communicates with a router wirelessly, by means of radio signals. the router is connected by cable directly to
Hoochie [10]
The answer would be 2500 Bits
4 0
3 years ago
In programming, what is a string?
Alla [95]

A way to store a sequence of letters, numbers or symbols.

This is the most accurate statement, though not entirely true.

Hope this helps.

7 0
3 years ago
Read 2 more answers
16.50. Suppose we have a sequential (ordered) file of 100,000 records where each record is 240 bytes. Assume that B = 2,400 byte
Nat2105 [25]

Answer and Explanation:

Given that total number of records in a file = 100000

Each record consists of= 240 bytes

Given that B= 2400 bytes.

Then total blocks in file = 100000 records * 240 / 2400

= 10000 blocks.

Time that will take for exhaustive read

= s + r + b.btt

= 16 + 8.3 + (10000) * 0.8

= 8024.3 msec

Now as per given X be the number of records that are searched randomly and it takes more than exhaustive read time.

Hence, X (s + r + btt) > 8024.3

X (16+8.3+0.8) > 8024.3

X > 8024.3/25.1

So that, X > 319.69

Hence, atleast 320 random reads should be made to search the file

8 0
3 years ago
Which best describes the benefits of renting a home
ANTONII [103]
Is it multiple choice or an essay question? If its an essay question I would say Living alone, being able to rent YOU'RE own home, and probably being able to decorate it the way you want. 
5 0
2 years ago
Read 2 more answers
Other questions:
  • You have been asked to create an authentication security plan for your company. Which of the following components would you inco
    14·1 answer
  • Helppppppppppppppppppp
    11·1 answer
  • What adds the element carbon to the environment
    10·2 answers
  • What is the most common concern with using variable frequency drives?
    6·1 answer
  • Which item is used for formatting in responsive web design?
    14·2 answers
  • If you give an actual answer I'll give brainliest​
    13·2 answers
  • Represent the measuring unit ofcomputer un terms of fration of second​
    13·1 answer
  • is a security design principle to direct the selection of control layers for an organization's computing enclave to ensure its r
    6·1 answer
  • Ron is creating building blocks in Word. How can he make the building blocks that he created available?
    10·2 answers
  • After Daniel performed poorly on a test, his teacher advised him to do some self-reflection to figure out how he could get a bet
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!