Menu



Manage

Cord > Study_Algorithm 전체 다운로드
Study_Algorithm > 9/week09_01_chap06_04.py Lines 27 | 472 바이트
다운로드

                        # week09_01_chap06_04
def is_stack_full():
    global SIZE, stack, top
    if top == SIZE-1:
        return True
    else:
        return False


def push(data):
    global SIZE, stack, top
    if is_stack_full():
        print("스택이 꽉 찼습니다.")
        return
    top += 1
    stack[top] = data


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

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