I get bound method error (for method isempty) when trying to run this code. I have coded python for about 2 hours so Im a little lost...
Also, if someone could post source the code of any small program consisting of multiple classes and objects, it would surely be a great help for me.
Code:
Also, if someone could post source the code of any small program consisting of multiple classes and objects, it would surely be a great help for me.
Code:
Code:
----------------------------------------- from Queue import Queue Q=Queue() inp=raw_input("Skriv indata: ") indata=inp.split(" ") i=0 while i<len(indata): Q.put(indata[i]) i=i+1 print Q.isempty ---------------------------------------- from Node import Node class Queue: front=None back=None def put(self, x): new=Node() new.value=x if self.front is None: self.front=new self.back=new else: self.back.next=new self.back=new def get(self): x=self.front self.front=self.front.next return x def isempty(self): return self.front==None ----------------------------------------------- class Node: value=None next=None
Comment