0
我一直在問:的SyntaxError而定義和調用函數
Write a function called
start_codon
which accepts a DNA sequence as its argument and returns the first codon as a string.
這是我到目前爲止有:
#!/usr/bin/python
def start_codon(dna):
codon1 = dna[0:3]
codonstring = codon1.split(",");
return codonstring
print (start_codon(「ATGGAACCAACGTCAGTGACTTCGTCAG」))
然而,當我按回車鍵,試圖調用該函數,我收到語法錯誤:
File "<stdin>", line 1
print (start_codon(「ATGGAACCAACGTCAGTGACTTCGTCAG」))
^
您發佈的樣本看起來像有「捲曲的引號」。你需要簡單的「直」雙引號或單引號字符。 – BrenBarn 2014-11-04 18:15:01
還要注意,儘管名稱是「codonstring」,但它仍然是一個列表。 – jonrsharpe 2014-11-04 18:15:58
@jonrsharpe我怎麼把它變成逗號分隔的列表?我認爲這就是第二個參數 – movietime 2014-11-04 19:00:14