Syntax Error: no ascii character input operation
<p>I've got quite a problem with python right now. I try around to just calculate a few integers in an array. So it should not be too complicated. I worked on it over a 2 days now, but can't get it to work.</p>

<pre><code>def calculate( str ):
    global x
    if (len(x)==9):
        a = []
        for i in x_str:
            a.append(i)
        print(a)
        b = 0
        for j in range(1,9):
            if (type(a[j])==int):
                b = b + (a[j] * j)
            else:
                print('Your x is not a number!')
        print(b)
    else:
        print('Your x is too long or too short.')
        isdn = input('Enter your x with 9 numbers')
        calculate( x )

# Operation

x =â¯input('How is your x?')
try:
    x =â¯str( x )
    calculate( x )
except:
    print('Not a String!')
</code></pre>

<p>I just want to input an integer with 9 numbers and change that to an array. And do a simple calculation then with it.</p>

<p>I tried to do it without that damn try and except first, but that does not work either. Somehow Python won't except that x is a string when I enter it with input. What can I do, to get this calculation to work? It keeps telling me:</p>

<pre><code>SyntaxError: Non-ASCII character '\xe2' in file
</code></pre>

<p>I am really desperate right now, since I cannot get it to work.... Somehow Python is mixing strings and integers up and I cannot understand why. I know other languages, but never had that much trouble to get a simple calculation to work. 
Does anyone can point me out my mistake? Or what I can do?</p>

<p>I changed:</p>

<ul>
<li><code>a.append(i)</code> to <code>a.append(int(i))</code></li>
<li>removed <code>global x</code></li>
<li><code>for i in x_str:</code> to <code>for i in x:</code></li>
<li>changed your <code>isdn</code> variable to <code>x</code></li>
</ul>

<hr>

<pre><code>def calculate( x ):
    if (len(x)==9):
        a = []
        for i in x:
            a.append(int(i))
</code></pre>

<hr>

<pre><code>else:
    print('Your x is too long or too short.')
    x = input('Enter your x with 9 numbers')
    calculate( x )
</code></pre>

<p>You also had bad (invisible) characters before the <code>x = input</code> and the <code>x = str ( x )</code>. I cleaned them up in the code below if you want to copy/paste.</p>

<pre><code>x = input('How is your x?')
try:
    x = str( x )
    calculate( x )
except:
    print('Not a String!')
</code></pre>

python python-3.x syntax