jangjusung / jusung-python

0 stars 0 forks source link

객체지향파이썬 #13

Open jangjusung opened 2 years ago

jangjusung commented 2 years ago

from ast import Delete

class Mstack: def init(self) : self.stack=[] print("hi")

def push(self, int1):
    self.stack.append(int1)
    print(self.stack, type(int1),self.stack[-1])

def pop(self):
    return self.stack.pop()

def length(self):
    return len(self.stack)

def __del__ (self):
    print(self.stack,"소멸")

if name =='main': a1=Mstack() for x in range(1,6): a1.push(x) a1.pop() print('length: ',a1.length()) del a1