For a college assignment, I have been tasked with calculating the genotypes of approximately 200 generations, with the code stopping when BB is greater than .99 . I have checked in with my Professor, who stated that my code looked good but there is a breakpoint somewhere that is causing the program to not write anything other than the tabulate headings to the output file. I tried diagnosing the issue by putting several outputFile.write("Breakpoint")
lines after each line in an attempt to find the issue (per my instructor's directives). Despite this, I am still unable to figure out why it is not outputting correctly.
I only want help figuring out exactly where/what the breakpoint is as I want to maintain as much academic honesty as possible since this is my major. I have been beating my head against the wall for the past several hours attempting to figure this out. Any help will be appreciated greatly!
Sample Incomplete Output Table: (This is what the output should look like, but only the bold portion is outputting.) Generation AA AB BB ========= ==== ==== ==== 1 0.250 0.500 0.250 2 0.111 0.444 0.444
from tabulate import tabulate
outputFile = open("genotype.txt", 'w')
x = 0.25
y = 0.5
z = 0.25
g = 1
t = [["Generation", "AA Gene", "AB Gene", "BB Gene"]]
outputFile.write(tabulate(t))
while z < 0.99:
table = [[g, x, y, z]]
(tabulate(table, floatfmt=("10.0f", "7.3f", "7.3f", "7.3f")))
p = 0.5 * (y / (y + z))
x = p * p
y = (2*p) * (1-p)
z = (1-p) * (1-p)
g = g+1
outputFile.close()
I tried executing the code and I am unable to figure out where the breakpoint is. It is not outputting anything to the table other than the bolded headings.