Question: I'm a Python newbie. What I wanted to do was calculate the differences between float numbers. Differences must be between the number after and the number before. So first difference must be between 2nd number and last number. Here's my code:

```
x = [811.91, 796.04, 796.14, 796.50, 796.81]

i = 0
for i in x:
    difference = x[i+1] - x[i-1]
    print(difference)

```

And I get "TypeError: list indices must be integers or slices, not float".

Answer: 
You can do something like this:

```
buttons = []
for i in range(11):
    buttons.append( tk.Button(root, text = ('out'+str(i)), bg=random.choice(color), command=lambda:code(i))
if b[0]['bg'] == 'red':
      pin = pin[:-1]

```

Now `buttons` is a list with button i at index i. You just have to rewrite your command `code(out1)` for example to take `i` as input instead of `out1`.
See classes in python !
class button(self):
 and here you put your code about buttons
This is really helpful because you can put more arguments than just self, and then call button(arguments) to create a new button !