I have tried re-spacing the entire file so that each indent consists of 4 spaces rather then tabs, but I still get an invalid syntax error at the else statement in push(). In case it is relevant I am using sublime text 3 to develop. Any suggestions would be appreciated, thank you.
from Stack import Stack
class stackOfPlates:
cap = 4
def _init_(self):
self.plates = []
def isEmpty(self):
return self.plates == []
def push(self, item):
p = Stack()
if ((self.isEmpty()) or (self.plates[len(self.plates)-1].size() == cap)):
p.push(item)
self.plates.append(p)
else:
self.plates[len(self.plates)-1].push(item)
def pop(self):
temp = self.plates[len(self.plates)-1].pop()
if(self.plates[len(self.plates)-1].isEmpty()): self.plates.pop()
return temp
def peek(self):
return self.plates[len(self.plates)-1].peek()
def size(self):
return len(self.plates)
Thanks @OdatNurd that solved my problem, there must have been something I was missing.