Python – While-Loop until list is empty

Your end criteria must be formulated a little differently: run the 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

Leave a Comment