Problem p03994 (python)

Fixed submission:
def num_to_char(s_num):
    ch = []
    for num in s_num:
        ch.append(alphabet[(num%26)-1])
    return ch

s = raw_input()
K = input()

alphabet = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','\
q','r','s','t','u','v','w','x','y','z']
ans = []

s_num = []
for char in s:
    s_num.append(alphabet.index(char) + 1)

for i in xrange(len(s_num)):
    if 27 - s_num[i] <= K and (s_num[i] != 1) and (i != len(s_num) - 1):
        K = K - (27 - s_num[i])
        s_num[i] = 27
    elif 27 - s_num[i] <= K and (s_num[i] == 1) and (i != len(s_num) - 1):
        pass
    elif 27 - s_num[i] > K and (s_num[i] != 1) and (i != len(s_num)-1):
        pass
    elif 27 - s_num[i] > K and (s_num[i] == 1) and (i != len(s_num) - 1):
        pass

    elif (i == len(s_num) - 1):
        s_num[i] = s_num[i] + K

print "".join(num_to_char(s_num))

Buggy submission (verdict: Runtime Error):
def num_to_char(s_num):
    ch = []
    for num in s_num:
        ch.append(alphabet[(num%26)-1])
    return ch

s = raw_input()
K = input()

alphabet = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
ans = []

s_num = []
for char in s:
    s_num.append(alphabet.index(char) + 1)thon WS) -----------------------------
for i in xrange(len(s_num)):ive/01_Atcoder/codefesA/A.py
    if 27 - s_num[i] < K and (s_num[i] != 1) and (i != len(s_num) - 1):
        K = K - (27 - s_num[i])1_GoogleDrive/01_Atcoder/
        s_num[i] = 271_Atcoder tong$ ls
#kouji.py#	20151121	B.py		Sort		kouji.py~
    elif 27 - s_num[i] < K and (s_num[i] != 1) and (i == len(s_num) - 1):wo.od        s_num[i] = s_num[i] + K
002		20160502	ColorTracking	contest
    elif 27 - s_num[i] < K and (s_num[i] == 1) and (i != len(s_num) - 1):
        passook-Pro:01_Atcoder tong$ mkdir codefesA
tonkous-MacBook-Pro:01_Atcoder tong$ cd codefesA/
    elif 27 - s_num[i] < K and (s_num[i] == 1) and (i == len(s_num) - 1):
        s_num[i] = s_num[i] + K


    elif 27 - s_num[i] >= K and (s_num[i] != 1) and (i != len(s_num)-1):
        pass

    elif 27 - s_num[i] >= K and (s_num[i] != 1) and (i == len(s_num)-1):
        s_num[i] = s_num[i] + K

    elif 27 - s_num[i] >= K and (s_num[i] == 1) and (i != len(s_num) - 1):
        pass

    elif 27 - s_num[i] >= K and (s_num[i] == 1) and (i == len(s_num) - 1):
        s_num[i] = s_num[i] + K

    #elif i == len(s_num) - 1:
       # s_num[i] = s_num[i] + K

print "".join(num_to_char(s_num))

Buggy submission (verdict: Runtime Error):
def num_to_char(s_num):
    ch = []
    for num in s_num:
        ch.append(alphabet[(num%26)-1])
    return ch

s = raw_input()
K = input()

alphabet = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
ans = []

s_num = []
for char in s:
    s_num.append(alphabet.index(char) + 1)thon WS) -----------------------------
for i in xrange(len(s_num)):ive/01_Atcoder/codefesA/A.py
    if 27 - s_num[i] < K and (s_num[i] != 1) and (i != len(s_num) - 1):
        K = K - (27 - s_num[i])1_GoogleDrive/01_Atcoder/
        s_num[i] = 271_Atcoder tong$ ls
#kouji.py#	20151121	B.py		Sort		kouji.py~
    elif 27 - s_num[i] < K and (s_num[i] != 1) and (i == len(s_num) - 1):wo.od        s_num[i] = s_num[i] + K
002		20160502	ColorTracking	contest
    elif 27 - s_num[i] < K and (s_num[i] == 1) and (i != len(s_num) - 1):
        passook-Pro:01_Atcoder tong$ mkdir codefesA
tonkous-MacBook-Pro:01_Atcoder tong$ cd codefesA/
    elif 27 - s_num[i] < K and (s_num[i] == 1) and (i == len(s_num) - 1):
        s_num[i] = s_num[i] + K


    elif 27 - s_num[i] >= K and (s_num[i] != 1) and (i != len(s_num)-1):
        pass

    elif 27 - s_num[i] >= K and (s_num[i] != 1) and (i == len(s_num)-1):
        s_num[i] = s_num[i] + K

    elif 27 - s_num[i] >= K and (s_num[i] == 1) and (i != len(s_num) - 1):
        pass

    elif 27 - s_num[i] >= K and (s_num[i] == 1) and (i == len(s_num) - 1):
        s_num[i] = s_num[i] + K

    #elif i == len(s_num) - 1:
       # s_num[i] = s_num[i] + K

print "".join(num_to_char(s_num))