title: Python 2.7 If middle_name is null print something else print something else
body: <p>I'm trying to build an online MASH game. How do I output: </p>
  
  <p>print "Welcome to the program {} {}".format(self.first_name, self.last_name) if no middle name is entered but:</p>
  
  <p>print "Welcome to the program {} {} {}".format(self.first_name, self.middle_name, self.last_name) if a middle name is entered:</p>
  
  <p>class Name (object):</p>
  
  <pre><code>def __init__(self, first_name='', last_name='', middle_name=''):
      if not first_name:
          first_name = raw_input("What is your first name: ")
      if not last_name:
          last_name = raw_input("What is your last name: ")
      if not middle_name:
          middle_name = raw_input("What is your middle name[Leave blank if not applicable]: ")
          if middle_name == '':
              print "No middle name here!"
      self.first_name = first_name
      self.last_name = last_name
      self.middle_name = middle_name
      self.print_name()
  
  def print_name(self):
      if not middle_name:
          print "Welcome to the program {} {}".format(self.first_name, self.last_name)
      else:
          print "Welcome to the program {} {} {}".format(self.first_name,
                                                     self.middle_name,
                                                     self.last_name)
  </code></pre>
  
  <p>chris = Name()</p>