title: What else do I need for CodeHS 8.3.8: Word Ladder?
body: <p>This is what I am supposed to do:</p>
  
  <p>Your friend wants to try to make a word ladder! This is a list of words where each word has a one-letter difference from the word before it. Here’s an example:</p>
  
  <pre><code>cat
  cot
  cog
  log
  </code></pre>
  
  <p>Write a program to help your friend. It should do the following:</p>
  
  <ul>
  <li>Ask your friend for an initial word.</li>
  <li>Repeatedly ask them for an index and a letter.</li>
  <li>You should replace the letter at the index they provided with the letter they enter.</li>
  <li>You should then print the new word.</li>
  <li>Stop asking for input when the user enters -1 for the index.</li>
  </ul>
  
  <p>Here’s what should be happening behind the scenes:</p>
  
  <ul>
  <li>You should have a function, <code>get_index</code>, that repeatedly asks the user for an index until they enter a valid integer that is within the acceptable range of indices for the initial string. (If they enter a number out of range, you should output <code>invalid index</code>.)</li>
  <li>You should have another function, <code>get_letter</code>, that repeatedly asks the user for a letter until they enter exactly one lowercase letter. (If they enter more than one character, you should output <code>Must be exactly one character!</code>. If they enter a capital letter, you should output <code>Character must be a lowercase letter!</code>.)</li>
  <li>You should store a list version of the current word in a variable. This is what you should update each time the user swaps out a new letter.</li>
  <li>Each time you have to print the current word, print the string version of the list you are keeping in your variable.</li>
  </ul>
  
  <p>Here’s what an example run of your program might look like:</p>
  
  <pre><code>Enter a word: cat
  Enter an index (-1 to quit): 1
  Enter a letter: o
  cot
  Enter an index (-1 to quit): 2
  Enter a letter: g
  cog
  Enter an index (-1 to quit): 5
  Invalid index
  Enter an index (-1 to quit): -3
  Invalid index
  Enter an index (-1 to quit): 0
  Enter a letter: L
  Character must be a lowercase letter!
  Enter a letter: l
  log
  Enter an index (-1 to quit): -1
  </code></pre>
  
  <p>This is my code right now:</p>
  
  <pre class="lang-py prettyprint-override"><code>word = input("Enter a word: ")
  for i in range():
      get_index = int(input("Enter an index (-1 to quit): "))
      if get_index &lt; -1:
          print "Invalid index"
      elif get_index &gt; 3:
          print "Invalid index"
      else:
          letter = input("Enter a letter: ")
          word = word[:get_index] + letter + word[get_index + 1:]
          print word
  </code></pre>
  
  <p>So I'm not entirely sure how to make an <code>if</code>/<code>else</code> statement for all capital letters and only allow one letter. I'm also not sure about what I need to put in my <code>for</code> loop to make it end when I enter <code>-1</code>.</p>