728x90
반응형
# 암호해독
# 머쓱이는 적군 암호체계를 깨달았다
# 암호 문자열중 배수만 뽑아냄
def solution(cipher, code):
answer = ''
for i in range(code-1,len(cipher),code):
# print(cipher[i])
answer+=cipher[i]
return answer
print(solution("dfjardstddetckdaccccdegk",4)) # attack
728x90
반응형
'Algorithm > Python' 카테고리의 다른 글
[programmers] python 181875 배열에서 문자열 대소문자 변환 (0) | 2024.05.07 |
---|---|
[programmers]python 120895 인덱스 바꾸기 (0) | 2024.04.18 |
[programmers]python 120845 주사위의 개수 (0) | 2024.04.16 |
[programmers]python 120839 가위바위보 (0) | 2024.04.16 |
[programmers]python 120837 개미군단 (0) | 2024.04.15 |