Why doesn't this work?
Posted
by Kyle W
on Stack Overflow
See other posts from Stack Overflow
or by Kyle W
Published on 2010-05-11T22:50:50Z
Indexed on
2010/05/11
22:54 UTC
Read the original article
Hit count: 141
python
take = raw_input('Please enter the string of numbers that compose code\n\n\t')
y = str(take)
l = []
for i in xrange(0, len(y), 3):
l.append(str(y[i:i+3]))
b = len(l)
a = 0
while(a!=b):
c = l[a].replace('444', ' ')
c = l[a].replace('111', 'a')
c = l[a].replace('112', 'b')
c = l[a].replace('113', 'c')
c = l[a].replace('114', 'd')
c = l[a].replace('115', 'e')
etc...
a = a + 1
filename = 'decmes.txt'
file = open(filename, 'w')
file.write(c)
file.close()
I can enter anything, just 111 for example and it gives me back the same thing I put in. Maybe it's something dumb, but I can't figure it out.
© Stack Overflow or respective owner