본문 바로가기
개발일지/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