[Tutor] Counting the # of iterations OR storing # values in a list

Gautam Desai gautam.satya.desai at gmail.com
Mon Aug 13 01:15:42 EDT 2018


 Good evening,

I am currently working with the lattice.py code attached. The code is a
simulation that models the interactions between bacteria by producing a
lattice output.

Once you run the code, there should be both blue and red bacteria that show
on a lattice.  I can manipulate the size of the lattice to be an integer.
In this case, I have set it to 250

However, there are different bacteria cells occupying each "pixel" on the
lattice. I could count the number of red or blue bacteria on the output,
but with a size of 250 that would take an extremely long time.

I need to keep track of the number of red or blue cells in lists, and while
I know how to instantiate a list, I don't know how to store the information
I need in the list with the code given. The majority of the code has mostly
commented out explanations but not entirely.

Thank you for your time,


More information about the Tutor mailing list