Answers for "how to get last value in while loop in python"

1

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
Posted by: Guest on July-30-2020

Code answers related to "how to get last value in while loop in python"

Python Answers by Framework

Browse Popular Code Answers by Language