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. `