Can't figure out why this code runs perfect for input of 3 and breaks on 5. {homework}
<p>When I input 3 into the below code it prints perfectly in the shape I need. But when the input is > 3 the code seems to break as you can see in the pictures below. I think I've probably just been staring at this for too long and can't find the obvious stupid error. I'm somewhat new to python so please go easy. </p>

<pre><code>size = int(input("Size: "))

def middle1():
    count_middle1 = 0
    size_m1 = (size + 1)
    mid_1 = 1
    mid_2 = 1
    dots_a = 2
    bslsh = "\\"
    fslsh = "/"    
    while (count_middle1 != size):
        print("|"+("."*dots_a)+((fslsh+bslsh)*mid_1)+("."*size_m1)+((fslsh+bslsh)*mid_2)+("."*dots_a)+"|")
        mid_1+=1
        mid_2+=1        
        count_middle1+=1
        dots_a-=1
        size_m1-=2
middle1()
</code></pre>

<p><a href="http://i.stack.imgur.com/sQI3k.png" rel="nofollow">Input == 3</a></p>

<p><a href="http://i.stack.imgur.com/QjReC.png" rel="nofollow">Input == 5</a></p>

<p>Any help would be greatly appreciated!</p>

<p>If I understand it correctly you want two trees next to each other.</p>

<pre><code>|........./\................../\.........|
|......../\/\................/\/\........|
|......./\/\/\............../\/\/\.......|
|....../\/\/\/\............/\/\/\/\......|
|...../\/\/\/\/\........../\/\/\/\/\.....|
|..../\/\/\/\/\/\......../\/\/\/\/\/\....|
|.../\/\/\/\/\/\/\....../\/\/\/\/\/\/\...|
|../\/\/\/\/\/\/\/\..../\/\/\/\/\/\/\/\..|
|./\/\/\/\/\/\/\/\/\../\/\/\/\/\/\/\/\/\.|
|/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\|
</code></pre>

<p>There is two problems, one that I mentioned in the comments which is the <code>dots_a</code>. The second problem is your <code>size_m1</code>. Try to think what you need to change it to so it works for any <code>size</code>.</p>

python python-3.x python-3.5 python-3.5.2