Hi I am stuck on the project
Python Loops: Medical Insurance Estimates vs. Costs Project
for loop to iterate through
actual_insurance_costs and add each insurance cost to the variable
i looke at hint total_cost += insurance_cost, I dont understand this += why use it here?
That is one of the group of assignment operators which augments the current value to build up a tally (total).
a = 6
a += 7
print (a) # 13
my code is keep giving File “script.py”, line 7
total_cost += isurance_cost
IndentationError: expected an indented block
Since that line is in a loop body, it needs to be indented.
One gets the feeling you may have opted to challenge yourself by jumping right into a project, before completing the Learn Python 3 track. You’ll find that course is most essential to get ourselves up to speed. Suggest pause this project and look for that course in your dashboard. Spend the holidays working on it and you’ll find the projects a little easier to think through. They are intentionally written to let us see how much we are picking up and understanding.
Sorry only replied to you now, I am following the course data science step by step , but really find it difficult to understand the questions
Suggest take a deep dive into the Learn Python 3 track to reinforce the core of the language.
Can anyone explain why I’m getting this error? Looks to me like my code is the exact same as in the Hint provided.
Double check the
print() above your
Thanks! I see I left the closed parenthesis off… but why would it indicate the error is on line 12?
Sometimes error messages are very specific and sometimes they refer to lines of code above.