Menu

Python Program Execute Due Break Outside Loop Class Dnastring Str Def New Self S Return St Q43879743

This python program can not execute due to “break outside theloop”

class dnaString (str):
def __new__(self,s):
return str.__new__(self,s.upper())
def length (self):
return (len(self))
def getATCG (self,num_A,num_T,num_C,num_G):
num_A = self.count(“A”)
num_T = self.count(“T”)
num_C = self.count (“C”)
num_G = self.count (“G”)
return ( (self.length(), num_A, num_T, num_G, num_C) )

def printnum_A (self):
print (“Adenine base content A: {0}”.format(self.count(“A”)))
def printnum_T (self):
print (“Adenine base content T: {0}”.format(self.count(“T”)))
def printnum_C (self):
print (“Base content C: {0}”.format(self.count(“C”)))
def printnum_G (self):
print (“Base content G: {0}”.format(self.count(“G”)))

lines = []
print (“Enter a dns sequence: “)
while True:
line = input()
if line:
lines.append(line)
else: # hit enter two times
break
dna = ‘n’.join(lines)

x=dnaString(dna)
x.printnum_T()
x.printnum_A()

Expert Answer


Answer to This python program can not execute due to “break outside the loop” class dnaString (str): def __new__(self,s): return s…

OR