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>This are my two cents on that. What @mgilson is proposing also works of course but not in the way you specified (in the comments). Try to debug your code in your head after writing it.. Go through the for loop and perform 1-2 iterations to see whether the variables take the values you intended them to. <code>charCount</code> is never reassigned a value. It is always 0. And, yes <code>charCount += 1</code> would make it change but <strong>not</strong> in the way you want it to..</p>

<pre><code>def encrypt(plain):
    alphabet = 'abcdefghijklmnopqrwstuvwxyz'
    answer = ''
    for letter in plain:
        try:
            if alphabet.index(letter.lower()) % 2 == 0:
                answer += pycipher.Affine(7, 6).encipher(letter)
            else:
                answer += pycipher.Affine(3, 0).encipher(letter)
        except:
            answer += letter
    return answer

my_text = 'Your question was not very clear OP'
encripted_text = encrypt(my_text)
</code></pre>

<p>Also, i would not use <code>ord(ch)</code> because <code>ord('a') = 97</code> and not <code>0</code> therefore odd instead of even.</p>

python