Menu



Manage

Cord > Study_Algorithm 전체 다운로드
Study_Algorithm > 9/week09_02_chap06_04_self.py Lines 21 | 405 바이트
다운로드

                        # week09_03_chap06_04_self

# SRP (단일 책임 원칙) 위배
def push(data):
    global SIZE, stack, top
    if top == SIZE-1:  # if is_stack_full():
        print("스택이 꽉 찼습니다.")
        return
    top += 1
    stack[top] = data


SIZE = 5
stack = ["커피", "녹차", "꿀물", "콜라", None]
top = 3

print(stack)
push("환타")
print(stack)
push("게토레이")