L2 : 모음사전 Python

jhyunn·2023년 1월 19일
0

Programmers

목록 보기
39/69

L2 : 모음사전 Python

https://school.programmers.co.kr/learn/courses/30/lessons/84512

from itertools import product # 중복 순열

def solution(word):
    s = []
    for i in range(1, 6): # 1~5자리 문자열
        for p in product(['A', 'E', 'I', 'O', 'U'], repeat=i):
            s.append(''.join(p))
                
    return list(sorted(s)).index(word)+1

#중복 #순열 #조합 #product #itertools #permutations #combinations

profile
https://github.com/Sungjeonghyun

0개의 댓글