i want to distribute amount of money to operators but after append for loop jumps not to another variable:
op1 = []
op2 = []
op3 = []
operators = [op1, op2, op3]
unsigned_loans = [100, 200, 300, 400]
sum_of_all_loans = 0
for loan in unsigned_loans:
sum_of_all_loans += loan
per_user_amount = sum_of_all_loans / len(operators)
unsigned_loans.sort()
for oper in operators:
for loan in unsigned_loans:
print(loan)
if sum(oper) < per_user_amount:
oper.append(loan)
unsigned_loans.remove(loan)
print(oper)
output should be:
op1=[100, 200] op2=[300] op3=[400]
but now it displays
op1=[100, 300] op2=[200] op3=[400]