

나의 코드
def solution(ingredient):
answer=0
list_ingredient = []
for i in ingredient:
list_ingredient.append(i)
if list_ingredient[-4:] == [1,2,3,1]:
del list_ingredient[-4:]
answer+=1
print(answer)
return answer
solution([2, 1, 1, 2, 3, 1, 2, 3, 1])
'코딩테스트 파이썬 > 파이썬 프로그래머스 1단계' 카테고리의 다른 글
| 개인정보 수집 유효기간 (0) | 2023.05.22 |
|---|---|
| 성격 유형 검사하기 (0) | 2023.05.22 |
| 둘만의 암호 (0) | 2023.05.22 |
| 대충 만든 자판 (0) | 2023.05.22 |
| 신규 아이디 추천 (0) | 2023.05.22 |