Skip to content

Commit

Permalink
feat: 링버퍼 활용 실습 코드
Browse files Browse the repository at this point in the history
  • Loading branch information
ddubbu-dev committed Aug 16, 2024
1 parent 76136d1 commit 5ce83f5
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions data_structure/ring_buffer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
N = int(input("정수를 몇 개 저장할까요?:"))
arr = [None] * N

cnt = 0

while True:
if cnt >= N:
retry = input(f"계속 할까요? (y/n)")

if retry in ["N", "n"]:
exit()

arr[cnt % N] = int(input(f"{cnt+1}번째 정수를 입력하세요: "))
cnt += 1

print(f"arr={arr}\n")

0 comments on commit 5ce83f5

Please sign in to comment.