Indent Expected?
<p>I'm sort of new to python and working on a small text adventure it's  been going well until now I'm currently implementing a sword system where if you have a certain size sword you can slay certain size monsters. I'm trying to code another monster encounter and I have coded the sword stuff but I'm trying to finish it off with an <code>else</code> to the <code>if...elif...elif</code> statement and even though I have it in the right indentation it still says indent expected I don't know what to do here's the code:</p>

<pre><code>print ('you find a monster about 3/4 your size do you attack? Y/N')
yesnotwo=input()
if yesnotwo == 'Y':
    if ssword == 'Y':
        print ('armed with a small sword you charge the monster, you impale it before it can attack it has 50 gold')
        gold += 50
        print ('you now have ' + str(gold) + ' gold')
    elif msword == 'Y':
        print ('armed with a medium sword you charge the monster, you impale the monster before it can attack it has 50 gold')
        gold += 50
        print ('you now have ' + str(gold) + ' gold')
    elif lsword == 'Y':
        print ('armed with a large broadsword you charge the beast splitting it in half before it can attack you find 50 gold ')
        gold += 50
        print ('you now have ' + str(gold) + ' gold')
    else:
</code></pre>

<p>There is in fact multiples things you need to know about indentation in Python:</p>

<h2><strong>Python really care about indention.</strong></h2>

<p>In a lot of other language the indention is not necessary but improve the readability. In Python indentation replaces the keyword <code>begin / end</code> or <code>{ }</code> and is therefore necessary.</p>

<p>This is verified before the execution of the code, therefore even if the code with the indentation error is never reach, it won't work.</p>

<h2><strong>There are different indention errors and you reading them helps a lot:</strong></h2>

<p><strong>1. "IndentationError: expected an indented block"</strong></p>

<p>They are multiple reasons why you can have such an error, but the common reason will be:</p>

<ul>
<li><strong>You have a ":" without an indented block behind.</strong></li>
</ul>

<p>Here are two examples:</p>

<p><strong><em>Example 1, no indented block:</em></strong></p>

<p>Input:</p>

<pre><code>if 3 != 4:
    print("usual")
else:
</code></pre>

<p>Output:</p>

<pre><code>  File "&lt;stdin&gt;", line 4

    ^
IndentationError: expected an indented block
</code></pre>

<p>The output states that you need to have an indented block line 4, after the <code>else:</code> statement</p>

<p><strong><em>Example 2, unindented block:</em></strong></p>

<p>Input:</p>

<pre><code>if 3 != 4:
print("usual")
</code></pre>

<p>Output</p>

<pre><code>  File "&lt;stdin&gt;", line 2
    print("usual")
        ^
IndentationError: expected an indented block
</code></pre>

<p>The output states that you need to have an indented block line 2, after the <code>if 3 != 4:</code> statement</p>

<p><strong>2. "IndentationError: unexpected indent"</strong></p>

<p>It is important to indent blocks, but only blocks that should be indent.
So basically this error says:</p>

<p><strong>- You have an indented block without a ":" before it.</strong></p>

<p><strong><em>Example:</em></strong></p>

<p>Input:</p>

<pre><code>a = 3
  a += 3
</code></pre>

<p>Output:</p>

<pre><code>  File "&lt;stdin&gt;", line 2
    a += 3
    ^
IndentationError: unexpected indent
</code></pre>

<p>The output states that he wasn't expecting an indent block line 2, then you should remove it.</p>

<p><strong>3. "TabError: inconsistent use of tabs and spaces in indentation"</strong></p>

<ul>
<li>You can get some info <a href="https://www.python.org/dev/peps/pep-0008/#tabs-or-spaces" rel="nofollow">here</a>.</li>
<li>But basically it's, you are using tabs and spaces in your code.</li>
<li>You don't want that. </li>
<li>Remove all tabs and replaces them by four spaces.</li>
<li>And configure your editor to do that automatically.</li>
</ul>

<p><hr />
Eventually, to come back on your problem:</p>

<blockquote>
  <p>I have it in the right indentation it still says indent expected I don't know what to do</p>
</blockquote>

<p>Just look at the line number of the error, and fix it using the previous information.</p>

python indentation