Hi guys,
I am a beginner in Python and I am using PyScripter. Can someone help me why in this simple for loop example my output result is iterated. I expect only Total=80
I am a beginner in Python and I am using PyScripter. Can someone help me why in this simple for loop example my output result is iterated. I expect only Total=80
prices=[10,20,50] total=0 for item in prices: total= total + item print(f"Total: {total}")
Error:>>>
Total: 10
Total: 30
Total: 80
>>>