Storing user values in a Python list using a for loop
<p>This is my Code for Asking user to input the number of cities and should allow only that number of cities to enter
Requirement is to use For Loop</p>

<pre><code>global number_of_cities
global city
global li
global container
li = []
number_of_cities = int(raw_input("Enter Number of Cities --&gt;"))
for city in range(number_of_cities):
    city = (raw_input("Enter City Name --&gt;"))
    li = city
    print li[]
</code></pre>

<p>Instead of </p>

<pre><code>li = city
</code></pre>

<p>Use</p>

<pre><code>li.append(city)
</code></pre>

<p>Hope thi helps.</p>

python