Jun-19-2017, 09:50 PM
I think your index error on the deque is because your while loop upping/lowering the index. If the last item in that direction matches the while condition, the index will get too large/small for the deque, and give you an error. Like:
breakfast = ['spam', 'spam', 'spam', 'eggs'] index = 0 while True: print(breakfast[index]) index += 1The other problem I think has to do with the keys to your default dict being the third item, which is not unique. Each key can only hold one value. I think you want to append rather than updating:
factors = defautdict(list) for num, factor in [(2, 1), (2, 2), (3, 1), (3, 3), (4, 1), (4, 2), (4, 4)]: factors[num].append(factor)
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures