Skip to content

Commit d84b2bb

Browse files
committed
1 parent c2bb880 commit d84b2bb

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Hongjoo/lv1/둘만의암호.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
def solution(s, skip, index):
2+
li =["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
3+
sub_li = list(skip)
4+
# 1.res_li = li - list(skip) // Difference
5+
res_li = [x for x in li if x not in sub_li]
6+
input = list(s)
7+
answer = ''
8+
#2. find matching element's index(k) and add "index"
9+
# if the adding index is out of range ,using mod
10+
for i in range(len(input)):
11+
for k in range(len(res_li)):
12+
if input[i] == res_li[k]:
13+
answer += res_li[(k+index)%len(res_li)]
14+
break
15+
return answer

0 commit comments

Comments
 (0)