Loop character A/B alternately
<p>How can I print A/B character alternately in python loop?</p>

<p>What I expect in result:</p>

<pre><code>oneA
twoB
threeA
fourB
...
</code></pre>

<p>Something like:</p>

<pre><code>alternate_words = ['A', 'B']
    count = 0

while count &lt; 5:
    print count+1, alternate_words[count % len(alternate_words)]
    count += 1
</code></pre>

<p>Output:</p>

<p>1 A</p>

<p>2 B</p>

<p>3 A</p>

<p>4 B</p>

<p>5 A</p>

python loops for-loop