title: How do I print the names in CodeHS 8.4.4: How Many Names?
body: <p>This is what I'm supposed to do:</p>
  
  <p>The first part of this exercise is the same as the first part of How Many Names? in the Control Flow module.</p>
  
  <p>Some people have just a first name and a last name. Some people also have a middle name. Some people have five middle names.</p>
  
  <p>Write a program that asks the user how many names they have. (If they have a first name, two middle names, and a last name, for example, they would type 4.) Then, using a <code>for</code> loop, ask the user for each of their names. Store the names in a list.</p>
  
  <p>Then, use slices to separately print the person’s first name, middle name(s), and last name.</p>
  
  <p>An example run of your program might look like this:</p>
  
  <pre><code>Number of names: 4
  Name: Nora
  Name: Stanton
  Name: Blatch
  Name: Barney
  First name: Nora
  Middle name(s): ['Stanton', 'Blatch']
  Last name: Barney
  Your program should work regardless of how many middle names the person has!
  </code></pre>
  
  <p>Hints</p>
  
  <p>The index -1 may come in handy in a couple places.
  You’ll need to use the <code>str</code> function to print the middle names.</p>
  
  <p>I have found the correct answer to this problem. Here it is:</p>
  
  <pre><code>name_amount = int(input("How many names do you have? "))
  namelist = []
  index = 0
  for i in range (name_amount):
      name = input("Name: ")
      namelist.append(name)
      index += 1
  print "First name: " + namelist[0]
  print "Middle names: " + str(namelist[1:-1])
  print "Last name: " + namelist[-1]
  </code></pre>