문제: 10개 미만의 서로 다른 문자(symbols)와 10 이하의 숫자(n)가 주어졌을 때, n개의 symbol로 이루어진 문자열의 모든 조합을 알파벳 순서대로 출력하시오 from itertools import product handle=[] with open('rosalind_lexf.txt','r') as f: for line in f: handle.append(line.strip()) symbols=sorted(handle[0].replace(' ','')) length=int(handle[1]) result=list(product(symbols,repeat=length)) for s in result: print(''.join(s)) 1. 주어진 파일에서 symbols와 n을 분리 2. itertools의 product ()함수 사용해 모든 조합을 출력 3. product()는 각 요소를 튜플 형태로 출력하므로, 문자열로 전환...
#
LEXF