How to store values retrieved from a loop in different variables in Python?
<p>Just a quick question.<br>
Suppose, I have a simple for-loop like  </p>

<pre><code>for i in range(1,11):
    x = raw_input() 
</code></pre>

<p>and I want to store all the values of <em>x</em> that I will be getting throughout the loop in <em>different variables</em> such that I can use all these <em>different variables</em> later on when the loop is over.</p>

<p>You can form a list with them.</p>

<pre><code>your_list = [raw_input() for _ in range(1, 11)]
</code></pre>

<p>To print the list, do:</p>

<pre><code>print your_list
</code></pre>

<p>To iterate through the list, do:</p>

<pre><code>for i in your_list:
    #do_something
</code></pre>

python python-2.7 for-loop iteration