Im looking to create a program in python that asks the user to enter a list of numbers in [] format.
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 ect.
Here is what i have so far.
my_num = [int(i) for i in raw_input("Enter numbers... ").split(",")]
the_list = eval(my_num)
number = 0
if 1<= my_num and my_num <=10:
number = number + 1
This will give you groups of numbers, and you can count the instances in the group with calls to
len(). For instance, replaceThe important thing is to sort the numbers first.
With this as input:
Or the output with the len call instead:
Which could then be formatted like this:
Yielding: