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>It looks like you have a list of lists instead of a list of ints when you call <code>result.append([code-offset])</code>. This means later when you call <code>chr(i) for i in result</code>, you are passing a list instead of an int to <code>chr()</code>.</p>

<p>Try changing this to <code>result.append(code-offset)</code>.</p>

<p>Other small suggestions:</p>

<ul>
<li><a href="https://docs.python.org/2/library/functions.html#raw_input" rel="nofollow"><code>raw_input</code></a> already gives you a string, so there's no need to explicitly cast it.</li>
<li><p>Your removal of special characters can be more efficiently written as:</p>

<pre><code>special_characters = '1234567890~`!@#$%^&amp;*()_-+={[}]|\:;'&lt;,&gt;.?/'
string_lowercase = ''.join(c for c in string_lowercase if string not in special_characters)
</code></pre>

<p>This allows you to only have to iterate through <code>string_lowercase</code> once instead of per character in <code>special_characters</code>.</p></li>
</ul>

python ascii chr