본문 바로가기
개발일지/Python

파이썬 리스트 insert응용 암호문

by 다니엘의 개발 이야기 2022. 5. 10.
320x100
secret = '27156231'
secretList =[]
solvedList = ''

for cha in secret:
    secretList.append(int(cha))

secretList.reverse()
print(secretList)

val = secretList[0] * secretList[1]
secretList.insert(2, val)
print(secretList)
print()

val = secretList[3] * secretList[4]
secretList.insert(5, val)
print(secretList)
print()

val = secretList[6] * secretList[7]
secretList.insert(8,val)
print(secretList)
print()

val = secretList[9] * secretList[10]
secretList.insert(11, val)
print(secretList)
300x250