How to append even and odd chars python
<p>I want to convert all the even letters using one function and all the odd numbers  using another function. So, each letter represents 0-25 correspsonding with a-z, so a,c,e,g,i,k,m,o,q,s,u,w,y are even characters.</p>

<p>However, only my even letters are converting correctly. </p>

<pre><code>def encrypt(plain):
    charCount = 0
    answer=[]
    for ch in plain:
        if charCount%2==0:
            answer.append(pycipher.Affine(7,6).encipher(ch))
        else:
            answer.append(pycipher.Affine(3,0).encipher(ch))
    return ''.join(answer)
</code></pre>

<p>Since your notion of <em>even letter</em> is based on the position of a character in the alphabet, you could use <a href="https://docs.python.org/3/library/functions.html?highlight=ord#ord" rel="nofollow"><code>ord()</code></a>, like this:</p>

<pre><code> if ord(ch)%2==0:
</code></pre>

<p>Note that <code>ord('a')</code> and <code>ord('A')</code> are both odd, so that would make <code>a</code> go in the <code>else</code> part. If you want the opposite, then just negate the condition:</p>

<pre><code> if ord(ch)%2!=0:
</code></pre>

python