how to only print final iteration of a for loop pyhton

prices = [10, 20, 30]
total = 0
for price in prices:
    total += price
	#print(f'total: {total}') will give all iterations in order
print(f'total: {total}') #make sure to print outside of loop for 
#only final iteration to print

Here is what the above code is Doing:
1. We create a list of prices.
2. We create a variable called total and set it to 0.
3. We create a for loop that iterates through the prices list.
4. We add each price to the total variable.
5. We print the total variable outside of the for loop.