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]
3 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]3 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
Write a for loop to print all elements in courseGrades, following each element with a space (including the last). Print forwards
Oksanka [162]

Answer:

Following are the loop in c language

t = sizeof(courseGrades)/sizeof(courseGrades[0]);  // determine the size of array

   for(int i=0;i<t;++i) // iterating loop

   {

printf("%d ",courseGrades[i]);  // print the array in forward direction with space  

   }

   for(int i=t-1;i>=0;--i)// iterating loop

   {

printf("%d ",courseGrades[i]); // print the array in backward direction with space

  }

Explanation:

In this firstly we find a size of the courseGrades array in variable "t" after that we created a loop for print  the courseGrades array in forward direction with space.

finally we created a loop  for printing  the courseGrades array in backwards direction.

Following are the program in c language :

#include <stdio.h> // header file

int main() // main function

{

   int courseGrades[]={7, 9, 11, 10}; // array declaration

  int t; // variable t to store the length of the array

  t = sizeof(courseGrades)/sizeof(courseGrades[0]); // determine the size of array

   for(int i=0;i<t;++i)  // iterating loop

   {

printf("%d ",courseGrades[i]); //print the array in forward direction with space  

       

   }

   for(int i=t-1;i>=0;--i) // iterating loop

   {

printf("%d ",courseGrades[i]);//  // print the array in backward direction with space  

       

   }

  return 0;

}

Output:

7 9 11 10 10 11 9 7

4 0
3 years ago
You hide three worksheets in a workbook and need to unhide them. How can you accomplish this?.
ale4655 [162]

Answer:

1. Right-click the sheet tab you want to hide, or any visible sheet if you want to unhide sheets.

2. On the menu that appears, do one of the following: To hide the sheet, select Hide. To unhide hidden sheets, select them in the Unhide dialog that appears, and then select OK.

Explanation:  have a good day!

7 0
3 years ago
Assume you're running a query on your orders in the past year. You want to see how many orders were placed after May. What type
vitfil [10]

Your answer is A. Because a query is a question about a an organization to check how it's going


6 0
3 years ago
A(n) ______ database stores data in tables that consist of rows and columns.
melisa1 [442]
The answer is a spreadsheet.
4 0
4 years ago
Read 2 more answers
What is the current DoD repository for sharing security authorization packages and risk assessment data with Authorizing officia
Tems11 [23]

Answer:

The answer is "Army Portfolio Management System".

Explanation:

The Army Way to solve Information-Technology (APMS-AITR) portfolio management registration for IT investment, IT capacity, and IT software was its single legal army registry.

Its main goal of IM/IT Management Of working capital and Corporate Finance is to prioritize IM/IT expenditure by evaluating and handling TRADOC as just an investment portfolio. The APMS was its main decision supporting instrument for military portfolio management.

8 0
3 years ago
Other questions:
  • You are the system administrator for a medium-sized Active Directory domain. Currently, the environment supports many different
    7·1 answer
  • &gt;&gt;&gt; from hog import *
    15·1 answer
  • 50 POINTS<br><br>Question linked in file below.
    5·1 answer
  • What techniques are required to accept
    12·1 answer
  • What is the full form of 'Rom<br>​
    7·2 answers
  • Adobe Indesign project 4 museum indesign file. The instructions are 70 pages long I cant sit still long enough to read them
    11·1 answer
  • QN, 3. Write the working principle of computer.<br>​
    8·1 answer
  • Question #2
    15·2 answers
  • For python how do I ask the user how many numbers they want to enter and then at the ending add those numbers up together?
    10·1 answer
  • Assuming a single-processor system, that load and store are atomic, that x is initialized to 0, and that x must be loaded into a
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!