-3
    def startpop(pop,job):
       i = 0 
       L = [[[(random.uniform(1,0))]]] 
       while i < pop:
          k = 0 
          if len(L) <= i:
          L.append([[random.uniform(1,0)]])

I'm trying to understand this code. What is the meaning of three square brackets?

John Kugelman
  • 349,597
  • 67
  • 533
  • 578
Daniel
  • 13
  • 1
  • 3

1 Answers1

1

Is it simply a list in a list in a list:

[
    [
       [
           (random.uniform(1,0))
       ]
    ]
 ]

i.e.

>>> test = [[[1,2]]]
>>> print test[0]
[[1,2]]
>>> print test[0][0]
[1,2]
>>> print test[0][0][0]
1
Farmer Joe
  • 6,020
  • 1
  • 30
  • 40