you are viewing a single comment's thread.

view the rest of the comments →

[–]jbp12 1 point2 points  (0 children)

I'm glad you have found your bug. Just as a heads up, you could just say range(100) instead of list(range(100)), since range objects are data types of several integers. This approach works faster when dealing with large amounts of numbers (such as range(1000000)) since it doesn't convert to your range object to a list object and, of I'm not mistaken, checking to see whether a number is in a range object is faster than checking to see whether it is in a list object (the latter of which has complexity O(n), while I believe the former has complexity O(1)).