Thank you for reading this.
Python 3 under Linux.

I'd like to set up a two dimensional list of counters as follows;

count = [
            [0],
            [0],
            [0]
        ]

And then increment the first counter as follows;

count [0] += 1

This fails with the following error;

TypeError: 'int' object is not iterable

The array module looks like the answer because it seems to function in the same way as an array under C. However, it seems to me that I should be able to do the same thing with a list.

Is there a way to add a value to a list of ints?

--
Regards,
Phil
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to