我的任务是使o成为一个名为count\u nucleotides的函数,该函数用于处理字符串、一个单词和一个字母,并计算字母的出现数。例如:
计数核苷酸('ATCGGC','G')并给出2
计算核苷酸('ATCTA','G'),得出0
我的代码如下:
def count_nucleotides(dna, nucleotide):
count = 0
num = nucleotide
for char in dna:
if char = num:
count = count +1
return count
它返回一条消息:预期的是一个预期的块
我是python编程新手,所以如果有人能解释一下而不是问一些问题,比如在哪里定义这个或那个,我将不胜感激。这是我的第一个任务,所以请原谅我看到了什么
你必须indent your function body
相关问题 更多 >
编程相关推荐