[Tutor] Why am I getting an infinite loop?

Christopher Keelan rufmetal@interlog.com
Sun, 27 Aug 2000 19:12:21 -0400


I'm working through an exercise in O'Reilly's "Learning Python".

Here's the code
---
l=[1,2,4,8,16,32,64]
d=5
i = 0

print 'length of list is', len(l)
while i < len(l):
    if 2**d == l[i]:
        print 'at index', i
        break
        i = i+1
    else:
        print d, 'not found'
---

When I test it by running the script, I get an infinite loop at the print
statemnt. Any ideas why this is happening?

Thanks in advance.

- Chris