hello Im trying to solve the Carly’s Clipper project on the Computer science path. Link to project
but I’m having an issue with the second prompt, as It asks to iterate through a list and add or sum up each element and print the output into a variable. I decided to use a for loop and in the body of the loop create a variable called price and used .pop() to take each element in the variable and with a simple plus equals operation add each element taken from the list into the total variable. I will try to attach the prompt, and the code I am trying. My code is not raising any errors, but it is cutting off after just. a few elements.
" Iterate through the
prices list and add each price to the variable
prices = [30, 25, 40, 20, 20, 35, 50, 35]
total_price = 0 for price in prices: price = prices.pop() total_price += price print(total_price)
I hope I have the formatting right