Hey guys I have question four you.
I have this.
prices = [30, 25, 40, 20, 20, 35, 50, 35] total_price = 0 total_price += [price for price in prices] print(total_price)
This does not work. Apparently I can not use
+= with list or something.
So I did it the other way.
prices = [30, 25, 40, 20, 20, 35, 50, 35] total_price = 0 for price in prices: total_price += price print(total_price)
I have achieved what I wanted but I am curious if there is some way to make less complicated as in first case. Is there something that I can do with first code so I can make it work it that way?