我已经写了这个函数,但我不断收到断言错误,我不知道为什么???
def amino(codonfile, DNA):
"""This function reads the 64-line codon file and then converts the DNA string entered into an amino acid string."""
codonfile = []
for line in codonfile:
x,y = line.split()
if DNA == dict[x]:
return dict[y]
codonfile = open("codon.txt","r")
codonfile.close
assert(amino("codon.txt","TTT")== "Phe")
assert(amino("codon.txt","TTATTCTTGTCT")== "LeuPheLeuSer")
assert(amino("codon.txt","TTAGGGCCCTAC")== "LueGlyProTyr")
print("passed")