0
Why c instead of a?
Hi , my problem is that my code encripts the letters z and y with c and d instead a and b This is the code: g=['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'] k=['h','o','l','y'] f=0 while f<len(k): try: p=g.index(k[f]) u=p+2 k.remove(k[f]) k.insert(f,g[u]) f=f+1 except: c=p-24 print(g[c]) k.insert(f,g[c]) print(k) Any idea of why it happens?
2 Respuestas
0
while f<len(k):
try:
p=g.index(k[f])
u=p+2
k.remove(k[f])
k.insert(f,g[u])
except:
c=p-24
print(g[c])
k.insert(f,g[c])
f += 1
print(k)
f = f + 1 should be outsider try except.
0
Ahh so that was the problem,thanks for answering!