So I’m on step 8 of this project, I managed to do it but I don’t really understand what I’ve done. Here is step 8 as well as step 7 for context:
7) Carly really wants to make sure that Carly’s Clippers is a profitable endeavor. She first wants to know how much revenue was brought in last week. Create a variable called `total_revenue` and set it to `0` . 8) Use a `for` loop to create a variable `i` that goes from `0` to `len(hairstyles)`
Here is the code I created:
total_revenue = 0 for i in range(len(hairstyles)): total_revenue += prices[i] total_revenue += last_week[i]
I had to use a hint for the first part of the code
for i in range(len(hairstyles)):
I dont understand what I’m doing here or why
Why am I getting the length of “hairstyles” and then getting the range of the length?
Is it because i’m iterating through the range of indices in the variable? If so, couldn’t I have just done
for i in hairstyles:
Doesn’t that have the same effect?