Skip to main content
added 224 characters in body
Source Link
munk
  • 13.2k
  • 10
  • 54
  • 72

The two brackets mean you're accessing an element in a list of lists (or dictionaries, depending on whether they key is a string or integer).

So in this example, it might look something like this

In [17]: employees = {'joe': ['100', 0], 'sue': ['200', 0]} In [18]: x = 'joe' In [19]: i = 0 In [20]: employees[x][i] Out[20]: '100' 

The two brackets mean you're accessing an element in a list of lists (or dictionaries, depending on whether they key is a string or integer).

The two brackets mean you're accessing an element in a list of lists (or dictionaries)

So in this example, it might look something like this

In [17]: employees = {'joe': ['100', 0], 'sue': ['200', 0]} In [18]: x = 'joe' In [19]: i = 0 In [20]: employees[x][i] Out[20]: '100' 
Source Link
munk
  • 13.2k
  • 10
  • 54
  • 72

The two brackets mean you're accessing an element in a list of lists (or dictionaries, depending on whether they key is a string or integer).