Unit: Unit 3: Loops • Interactive Practice
Interactive Python programming tutorial and practice in your browser.
# Process only valid, non-negative transactions
transactions = [100, -25, 250, 0, -50, 400]
processed_total = 0
for tx in transactions:
if tx <= 0:
print("Skipping non-positive transaction:", tx)
continue # Skip remainder of this iteration, proceed directly to next item
print("Processing credit transaction:", tx)
processed_total += tx
print("Total processed revenue:", processed_total)