I'm working with Django and I have a queryset of objects that has been converted to a list (
while bucket > 0:
unpaid_sale = unpaid_sales.pop(0)
pop from empty list
Your end criteria must be formulated a little differently: loop while there are items and the
bucket is positive.
or is not the right operation here.
while unpaid_sales and bucket > 0 unpaid_sale = unpaid_sales.pop(0) #do stuff