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>You never change <code>charCount</code> in your loop -- So it starts at <code>0</code> and stays at <code>0</code> which means that each <code>ch</code> will be treated as "even".</p>

<p>Based on your update, you actually want to check if the character is odd or even based on it's "index" in the english alphabet.  Having some sort of mapping of characters to numbers is helpful here.  You could build it yourself:</p>

<pre><code>alphabet = 'abcde...'  # string.ascii_lowercase?
mapping = {k: i for i, k in enumerate(alphabet)}
</code></pre>

<p><em>OR</em> we can use the builtin <code>ord</code> noticing that <code>ord('a')</code> produces an odd result, <code>ord('b')</code> is even, etc.</p>

<pre><code>def encrypt(plain):
    answer=[]
    for ch in plain:
        if ord(ch) % 2 == 1:  # 'a', 'c', 'e', ...
            answer.append(pycipher.Affine(7,6).encipher(ch))
        else:  # 'b', 'd', 'f', ...
            answer.append(pycipher.Affine(3,0).encipher(ch))
    return ''.join(answer)
</code></pre>

python