What I am doing is creating a function that returns a list containing every number in a list of bases raised to every number in a list of powers. So, using a nested for loop I wrote two different ways:

First:

```
def exponents(bases, powers):
  lst = []
  for p in powers:
    for b in bases:
      lst.append(b ** p)
  return lst

print(exponents([2, 3, 4], [1, 2, 3]))

```

This prints:

```
[2, 3, 4, 4, 9, 16, 8, 27, 64]

```

These values are wrong.

Second:

```
def exponents(bases, powers):
  lst = []
  for b in bases:
  for p in powers:
    lst.append(b ** p)
  return lst

print(exponents([2, 3, 4], [1, 2, 3]))

```

This prints:

```
[2, 4, 8, 3, 9, 27, 4, 16, 64]

```

These are the correct values.

Why do these two very similar functions give different values? Is it related to floating point error?