def contains_sequence(dna1, dna2):
''' (str, str) -> bool
Return True if and only if DNA sequence dna2 occurs in the DNA sequence
dna1.
>>> contains_sequence('ATCGGC', 'GG')
True
>>> contains_sequence('ATCGGC', 'GT')
False
'''
b=False
len2=len(dna2)
i=0
for j in dna1:
temp=dna1[i:i+len2]
if temp == dna2:
b=True
i=i+1
return b
我是Python的新手。上面粘贴的程序在特定行"if temp == dna2:"给了我一个"缩进使用不一致"的错误。请问有人能帮我找出缩进如何不正确吗?
cat -evt <yourfile.py>
命令的输出结果,这将分别显示空格和制表符。 - Rohan