- 문제

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

 

프로그래머스

코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.

programmers.co.kr

- 코드 및 문제 풀이

 

from string import ascii_lowercase

a= list(ascii_lowercase)

 

를 하면 소문자 알파벳을 순서대로 나열한 리스트가 생성된다. 라이브러리를 알고 있으면 편리하니까 외우도록 하기!!

from string import ascii_lowercase

def solution(s, skip, index):
    al_list = list(ascii_lowercase)
    answer = []

    for i in range(len(skip)):
        del al_list[al_list.index(skip[i])]

    for i in range(len(s)):
        ans = al_list[(al_list.index(s[i])+index) %len(al_list)]
        answer.append(ans)

    return ''.join(answer)

+ Recent posts