Question: I crawled the web but no answer (specific to solution). I got stuck with the following:

```
coin = [2.0 , 1.0 , 0.5, 0.1, 0.05, 0.02, 0.01]
kum=0.0

for i in coin :
while True :
    if kum + coin[i]  >= x :
# Intial (first loop) this should be equal to: if 0 + 2.0 > users input
# Second loop should be equal to if 2.0 + 1.0 > users input
        break
    else :
        kum +=  coin[i]

```

Console says:

```
Traceback (most recent call last):
  , line 13, in <module>
if kum + coin[i]  >= x :
TypeError: list indices must be integers, not float

```

I was wondering what I'm doing wrong.
The list item is float? Adding 0.0 and float should not be the problem?
 Any help is appreciated.
`

Answer: 
Your code is broken, and the compiler has told you what the problem is.

You are trying to index a list with a float.
The index must be an integer, but this:

```
for i in coin :
while True :
    if kum + coin[i]  >= x :
        break
    else :
        kum +=  coin[i]

```

Is using the values from each element in coin to index coin itself, so the indexes will be `[2.0 , 1.0 , 0.5, 0.1, 0.05, 0.02, 0.01]`

So what you are asking is for the second, first elements, and then element 0.5 etc..

You probably mean

```
if kum+i >=x :

```

Additionally, you have an infinite loop inside your for. Remove the `while True :` as follows:

```
for i in coin :
    if kum+i >=x :
        break
    else :
        kum += i

```

Then, the loop will execute once for each element in coin, and i will be set to the values in coin[], ie:

* Iteration 1, i=2.0
* Iteration 2, i=1.0
* Iteration 3, i=0.5

etc
Thanks guys, the problem was :

```
for i in coin :

```

changed that to:

```
for i in range(0, len(coin)): 

```

Afterwards this makes a lot of sense to me...
just for the record: This "masterpiece" :) of code should check how much coins you need reach a specific value. 
user input is the value, coin the array for the coins exisiting (EUR).

```
x = input("Bitte Euro Betrag eingeben: ")
coin = [2.0 , 1.0 , 0.5, 0.1, 0.05, 0.02, 0.01]
coinscount = [0 , 0 , 0 , 0 , 0 , 0 , 0]
kum=0.0

if min(coin) > x :
print("Betrag zu klein")
exit 
for i in range(0, len(coin)):
while True :
    if kum + coin[i]  > x :
        break
    else :
        kum = kum +  coin[i]
        coinscount[i] += 1

print("Anzahl Muenzen ist: ", sum(coinscount))

for i in range(0, len(coin)):
print("Sie benoetigen: ", coinscount[i], "Stueck", coin[i])

```

Thanks a lot, Josi