Input integers to be counted by arrays or sections
<p>I am looking to create a program in python that asks the user to enter a list of numbers in [] format.</p>

<p>It then must count and display how many of those numbers in the list are between 1 and 10, 10 and 20,
20 and 30.</p>

<p>Each section of 10 are to be counted whether or not there is a number within that section meaning it can return a 0.</p>

<p>Here is what I have so far.</p>

<pre><code>the_input = raw_input("Enter numbers... ") 

the_list = [int(x) for x in the_input.strip("[]").split(",")] 

group_counter = {} 

for number in the_list:
    group_start = (number // 10) * 10 
    group_end = group_start + 9 
    group_name = "%s-%s" % (group_start, group_end) 

    group_counter.setdefault(group_name, 0) 
    group_counter[group_name] += 1 

for name, count in group_counter.items():
    print "There were %s in %s" % (count, name)
</code></pre>
