forked from nsshayan/Python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStack.py
39 lines (27 loc) · 794 Bytes
/
Stack.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 05 12:21:51 2016
@author: snaganan
"""
class stack:
def __init__(self):
print "stack created"
self.stackData = []
def push(self,data):
self.stackData.insert(0,data)
def pop(self):
popData = self.stackData[0]
del self.stackData[0]
return popData
def topElement(self):
return self.stackData[0]
def isEmpty(self):
if len(self.stackData) == 0 :
return True
else :
return False
def size(self):
return len(self.stackData)
# def __del__(self):
# del self.stackData
# print "Object cleaned up"