Hello everyone,
I’ve found loops a little more tricky to get my head around. Below is the example code and the solution
I don’t understand how this code works to get the total revenue based on haircuts last week. When we use range here, what are we actually doing with it? Does it create a temporary list with 0…len? And how does using prices[i] and last_week[i] work to get us the values we want? Why don’t they just iterate from index 0 to index len-1?
Hope that makes sense, it was confusing even writing it! Thanks very much in advance, greatly appreciated