title: How do I stop getting this append error in python?
body: <p>We have a class, <code>Message</code>, which models an e-mail message. A message has a recipient, a sender, and a message text. The class supports the following methods:</p>
  
  <ul>
  <li>a constructor, which accepts the sender and recipient as arguments     </li>
  <li><code>append</code> that takes one string argument and appends it to the message body as a new line</li>
  <li><code>__str__</code> that makes the message into one long string like this: "From: Harry Morgan\nTo: Rudolf Reindeer\n\nCome to the North Pole."      </li>
  </ul>
  
  <p>The error message I keep getting is at the bottom, how do I fix this?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>class Message:
      def __init__(self,sender,recipient,message=[]):
          self.sender = sender
          self.recipient = recipient 
          self.message = message
  
      def append(self,message): 
          self.message=self.message.append(message)
  
      def __str__(self): 
          print("\nFROM: "+sender+"\n"+"TO: "+recipient+"\n\n"+self.message)
  def main():
      message = []
      sender = input('Who is sending the message: ')
      recipient = input('Who would you like to send the message to: ')
      body = input('Enter body (blank line to quit): ')
      while body != '':
          message.append(body)
          body = input('Enter body (blank line to quit): ')
          if body == '':
              break
      print()
      print('FROM:', sender)
      print('TO:', recipient)
      print()
      print(*message,sep='\n') 
  if __name__ == '__main__':
      main()  
  
  An error occurred when appending a line to the message!
  </code></pre>