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
Luba_88 [7]
2 years ago
9

Implement a program called genes.py that does the following: a. Reads a DNA sequence t as command-line argument b. Reads strings

(one by one) representing genes from standard input until EOF (use the functions stdio.isEmpty() and stdio.readString()), and for each string s i. Constructs a Gene object g from s ii. Writes g iii. Writes whether g contains the DNA sequence t or not c. Writes the percentage of genes that contain t, up to two decimal places
Computers and Technology
1 answer:
Fantom [35]2 years ago
5 0

Answer:

Following are the code to this question:

import sys#import package sys

class Gene:#defining a class Gene

   gString = ""#defining a string variable

   def __init__(self, gString):#defining a constructor

       self.gString = gString#defining object to hold string value

gCount = 0#defining integer variable

mCount = 0#defining integer variable

t = input();#input value from user end

for s in sys.stdin:#defining for loop to check input value

   g = Gene(s)#defining g variable to pass value in class parameter

   gCount +=1#incrementing the value of gCount variable

   if(t in s):#defining if block to check input

       mCount +=1#incrementing the matchCount value

       print( g.gString,"True")#print value True

   else:#else block

       print( g.gString,"False")#print value False

   print("{:.2f}".format(mCount*100/gCount))#print percentage value

Output:

Please find attachment file.

Explanation:

In the code, a class Gene is declared, that defines a string variable geneString, and creates its constructor, and store the string variable value.

In the next step, a three-variable gCount, mCount, and t defined, in which variable "t" is used for an input value, and inside the for loop, it uses the conditional statement, that checks its value and increments the integer value, and print true or false as a message.

You might be interested in
Which is a common problem caused by the widespread use of computers?
Andru [333]
Hacking would be a widespread problem.
8 0
3 years ago
What an underlined word or phrase represents? (HTML AND CSS), has to be 9 letters long. kinda urgent
xz_007 [3.2K]

Answer:

hyperlink

Explanation:

Hyperlinks render as underlined by default, so that's my guess.

7 0
3 years ago
Can you please make a simple python program? I will give you 20 points and branliest if it is good! It must include:
alekssr [168]

Answer:

# Solve the quadratic equation ax**2 + bx + c = 0

# import complex math module

import cmath

a = 1

b = 5

c = 6

# calculate the discriminant

d = (b**2) - (4*a*c)

# find two solutions

sol1 = (-b-cmath.sqrt(d))/(2*a)

sol2 = (-b+cmath.sqrt(d))/(2*a)

print('The solution are {0} and {1}'.format(sol1,sol2))

Hope This Helps!!!

3 0
2 years ago
Read 2 more answers
Is the disk in the C: drive fixable or removable disk
katrin2010 [14]

Answer:

The disk is a removable disk.

8 0
3 years ago
Read 2 more answers
Which excel feature prevents you from having to type the same thing over and over?
tamaranim1 [39]

Answer:

Explanation: Another way by which you can do it, press the Ctrl+1 key on your keyboard, Format cells dialog box will get appear. Go to Alignment tab, Click on Justify in Vertical drop down list, click on ok. This is the way by which you can prevent the text from spilling over in Microsoft Excel 2010 and 2013.

6 0
2 years ago
Other questions:
  • What file would you edit to restrict the number of simultaneous logins a user can employ??
    14·1 answer
  • How to track flash socket server connections wireshark?
    10·1 answer
  • What are the advantages of upgrading computer hardware?
    13·2 answers
  • Which of these ia an example of gene flow?
    5·1 answer
  • Where does the list of incoming mail appear in gmail
    13·2 answers
  • What is the key to satisfaction and success when choosing a career
    15·2 answers
  • Ania has written this SimpleStopwatch class. In which line is she measuring the elapsed time?
    13·1 answer
  • 8.10 Code Practice Question 3
    6·1 answer
  • Explica el empleo de cuentas y contraseñas en archivos
    6·1 answer
  • Write a program to test if an integer input from the keyboard is odd or even. Sample Run 1: Enter a Number: 78 Even Sample Run 2
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!