# 방법 1. 일반 반복문 사용 f=open('rosalind_subs.txt','r') data=f.read().split('\n') seq=data[0] motif=data[1] mot_loc=[] for i in range(len(seq)): if seq[i:i+len(motif)]==motif: mot_loc.append(i+1) print(' '.join(map(str,mot_loc))) f.close() join 함수로 리스트의 요소들을 string 형식으로 바꿈.
앞의 ' '. 를 통해 요소들을 공백으로 구분 join은 리스트의 요소들이 string일 때만 사용 가능하기 때문에 map과 str 함수를 사용해 요소들을 string화 시킴 # 방법 2.
List comprehension f=open('rosalind_subs.txt','r') data=f.read().split('\n') seq=data[0] motif=data[1] lst=[i+1 for i in rang...
#
SUBS