Dec-30-2021, 09:28 PM
You've used
On line 24 and 25 you modify and then print x. But when the loop runs again and goes back to line 21, your modifications are lost.
I'm guessing you're trying to do something like this:
x
as your loop variable, so it is modified each time through the loop. If you want a variable to hold information across each cycle, you need to use a different variable.On line 24 and 25 you modify and then print x. But when the loop runs again and goes back to line 21, your modifications are lost.
I'm guessing you're trying to do something like this:
total = 0 for x in mlist[-t-1::-1]: print(f"Checking {x} against {add}") if x >= add: break total += x print("stop",total)