Convert number values into ascii characters?
<p>The part where I need to go from the number values I obtained to characters to spell out a word it not working, it says I need to use an integer for the last part?</p>

<p>accept string</p>

<pre><code>print "This program reduces and decodes a coded message and determines if it is a palindrome"
string=(str(raw_input("The code is:")))
</code></pre>

<p>change it to lower case </p>

<pre><code>string_lowercase=string.lower()
print "lower case string is:", string_lowercase
</code></pre>

<p>strip special characters</p>

<pre><code>specialcharacters="1234567890~`!@#$%^&amp;*()_-+={[}]|\:;'&lt;,&gt;.?/"

for char in specialcharacters:
    string_lowercase=string_lowercase.replace(char,"")

print "With the specials stripped out the string is:", string_lowercase
</code></pre>

<p>input offset</p>

<pre><code>offset=(int(raw_input("enter offset:")))
</code></pre>

<p>conversion of text to ASCII code</p>

<pre><code>result=[]
for i in string_lowercase:
    code=ord(i)
    result.append([code-offset])
</code></pre>

<p>conversion from ASCII code to text</p>

<pre><code>text=''.join(chr(i) for i in result)
print "The decoded string is:", text.format(chr(result))
</code></pre>

<p>You are passing a list to <code>chr</code> when it only accepts integers. Try <code>result.append(code-offset)</code>. <code>[code-offset]</code> is a one-item list.</p>

<p>Specifically, instead of:</p>

<pre><code>result=[]
for i in string_lowercase:
    code=ord(i)
    result.append([code-offset])
</code></pre>

<p>use:</p>

<pre><code>result=[]
for i in string_lowercase:
    code=ord(i)
    result.append(code-offset)
</code></pre>

<p>If you understand list comprehension, this works too: <code>result = [ord(i)-offset for i in string_lowercase]</code></p>

python ascii chr