title: Python indentation error while loop
body: <pre><code>while x &lt;= 9:
      result = usertype()
      if result == 'Correct':
  </code></pre>
  
  <p>I am receiving an indentation error on the "t" of result in "result = usertype(). Can anybody explain this? </p>
  
  <p>*EDIT
  I have tried rewriting it, and I checked to make sure that all of the indents are indeed indents and not spaces. Getting really frustrated and very confused now. I am thinking it might possibly be something in a previous line causing the problem. </p>
  
  <p>*EDIT 2
  Error copied from Command Prompt because IDLE doesn't work for me:</p>
  
  <pre><code>  File "&lt;stdin&gt;", line 5
      result = usertype()
           ^
  IndentationError: expected an indented block
  &gt;&gt;&gt;         if result == 'Correct':
    File "&lt;stdin&gt;", line 1
      if result == 'Correct':
      ^
  IndentationError: unexpected indent
  &gt;&gt;&gt;             x = x + 1
    File "&lt;stdin&gt;", line 1
      x = x + 1
      ^
  IndentationError: unexpected indent
  &gt;&gt;&gt;             y = y + 5
    File "&lt;stdin&gt;", line 1
      y = y + 5
      ^
  IndentationError: unexpected indent
  &gt;&gt;&gt;         else:
    File "&lt;stdin&gt;", line 1
      else:
      ^
  IndentationError: unexpected indent
  &gt;&gt;&gt;             x = x + 1
    File "&lt;stdin&gt;", line 1
      x = x + 1
      ^
  IndentationError: unexpected indent
  &gt;&gt;&gt;             y = y - a2
    File "&lt;stdin&gt;", line 1
      y = y - a2
      ^
  IndentationError: unexpected indent
  &gt;&gt;&gt;     return y
    File "&lt;stdin&gt;", line 1
      return y
      ^
  IndentationError: unexpected indent
  </code></pre>
  
  <p><strong>Solved!</strong>
  I'm not sure how, but I copy pasted my code into IDLE, untabified all regions then tabified again. I read somewhere else on SO to do that, so problem solved!</p>
  
  <p>Here is the entire program:</p>
  
  <pre><code>import random
  
  def usertype(raw_input):
      randletter = random.choice('qwer')
      print randletter
      userinput = raw_input('')
      if userinput == randletter:
          return 'Correct'
      else:
          return 'Incorrect'
  
  def usertypetest(raw_input):
      x=0
      y=0
      while x &lt;= 9:
          result = usertype()
          if result == 'Correct':
              x = x + 1
              y = y + 5
          else:
              x = x + 1
              y = y - a2
      return y
  
  print usertypetest(raw_input)
  </code></pre>