title: Python Linked List Append
body: <p>I made an append method for an UnorderedList() class that works fine in my IDLE window but when its assigned to the University's test of:</p>
  
  <pre><code>my_list = UnorderedList()
  my_list.append(13)
  for num in my_list: 
      print(num, end=" ")
  print()    
  </code></pre>
  
  <p>it returns an error: <code>AttributeError: Nonetype object has no attribute 'getNext'</code>.</p>
  
  <p>Here is the append method:   </p>
  
  <pre><code>def append(self,item):
      current = self.head
      while current.getNext() != None:
          current = current.getNext()
      current.setNext(Node(item))
  </code></pre>
  
  <p>Here is the rest of my classes and code:</p>
  
  <pre><code>class Node:
      def __init__(self,initdata):
          self.data = initdata
          self.next = None
  
      def getData(self):
          return self.data
  
      def getNext(self):
          return self.next
  
      def setData(self,newdata):
          self.data = newdata
  
      def setNext(self,newnext):
          self.next = newnext
  
  class UnorderedList:
  
      def __init__(self):
          self.head = None
          self.count = 0
  
      def append(self,item):
          current = self.head
          while current.getNext() != None:
              current = current.getNext()
          current.setNext(Node(item))
  </code></pre>
  
  <p>Why is the test returning that error and how I can fix my append method?</p>