I presume it’s just syntax I was ignorant of! Some form of list comprehension?…
self.organisms = [ Organism(random.randint(0, self.grid_size - 1), random.randint(0, self.grid_size - 1)) for _ in range(3) # Create 3 organisms for testing ]
submitted by /u/Cromulent123
[link] [comments]
r/learnpython I presume it’s just syntax I was ignorant of! Some form of list comprehension?… self.organisms = [ Organism(random.randint(0, self.grid_size – 1), random.randint(0, self.grid_size – 1)) for _ in range(3) # Create 3 organisms for testing ] submitted by /u/Cromulent123 [link] [comments]
I presume it’s just syntax I was ignorant of! Some form of list comprehension?…
self.organisms = [ Organism(random.randint(0, self.grid_size - 1), random.randint(0, self.grid_size - 1)) for _ in range(3) # Create 3 organisms for testing ]
submitted by /u/Cromulent123
[link] [comments]