Home Python 3: How do I place an incrementing literal in a loop?
 I want to set up a list of buttons inside a loop, with each button's command calling a function with a different value. for rank in range(21): self._rankButton.append(Button(self, text = "Rank " + str(rank), command = self._setDice(rank)) self._rankButton[0] should call self._setDice(0) self._rankButton[1] should call self._setDice(1) . . . self._rankButton[20] should call self._setDice(20)  the only way I get this to work is by configuring the buttons individually outside the loop