(Apr-17-2017, 10:42 PM)jhall710 Wrote:list = [4,6,12,9,1,2] S = 0 C = 0 X = 999 while list[0]: S = S + X C = C + 1
You're incrementing X and C, as long as list[0] is a Truthy value... but you're never modifying any of the elements in list, so list[0] will always be Truthy. Basically, you're doing some unrelated thing, while purposefully looping infinitely.
Also,
list
is a terrible variable name, since it's also a built-in function (and type). Maybe call it input
or items
instead?