This one seems really simple, I just can’t remember all these little commands and ways of formatting code.
I am racking my brain and flipping through my notes–I even watched a YouTube video about for-loops, I just cannot figure it out: How do I make the for-loop apply everything to a value? All I can get it to do is try to add the key to the total, which isn’t working for obvious reasons.
What I have so far is:
[indent]total = 0
[indent]for x in prices:
[2x-indent]x += total
It seems like this is trying to do arithmetic with strings, so naturally it’s returning an error. My problem is I cannot figure out what combination of a variable and brackets will solve this problem.
I know it’ll look like
but I can’t figure out what goes in the brackets and what goes before them.