Help with understanding list function
<p>When I type the following into the interpreter I get the desired output behavior:</p>

<pre><code>&gt;&gt;&gt; x = (7, 2, 1, 1, 6, 2, 1, 2, 1, 2, 2, 6)
&gt;&gt;&gt; y = list(x)
&gt;&gt;&gt; y
[7, 2, 1, 1, 6, 2, 1, 2, 1, 2, 2, 6]
</code></pre>

<p>Above, I simply converted a tuple to a list. However, when I run the following code I get an answer that I don't understand.</p>

<pre><code>pwm = input("enter PWM: ")
npwm = pwm.replace('),(', ', ')
y = list(npwm)
print(y)
</code></pre>

<p>Output:</p>

<pre><code>['(', '7', ',', ' ', '2', ',', ' ', '1', ',', ' ', '1', ',', ' ', '6', ',', ' ', '2', ',', ' ', '1', ',', ' ', '2', ',', ' ', '1', ',', ' ', '2', ',', ' ', '2', ',', ' ', '6', ')']
</code></pre>

<p>Can anyone explain to me what is happening? Why does the above code not product the desired output of:</p>

<pre><code>[7, 2, 1, 1, 6, 2, 1, 2, 1, 2, 2, 6]
</code></pre>

<p>EDIT: Wow, I can't thank everyone enough for the help! I greatly appreciate everyone's patients and willingness to help with my beginner questions. Thank you very much. Below is the solution that I got to worked:</p>

<pre><code>pwm = (7, 2, 1, 1),(6, 2, 1, 2),(1, 2, 2, 6)  
npwm = pwm.replace('),(',', ').strip('(').strip(')')  
y = list(ast.literal_eval(npwm))  
print(y)  
</code></pre>
