我已經寫了這個功能,但我不斷收到斷言錯誤,我不知道爲什麼?聲明錯誤:?
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")
顯然是因爲你的3個斷言之一失敗了...... –
向我們展示回溯,以便我們可以幫助您進行調試。您可以添加一個斷言文本('assert(expression,「some assertion identify here text)),以幫助簡化調試。 –
+1 2 Joran Beasley)顯示堆棧跟蹤。 – alexvassel