Help with excercise - Python Syntax: Medical Insurance Project

Welcome to the Get Help category!

Hello together I am a novice to programming and in the data analyst course the following exercise: Python Syntax: Medical Insurance Project - I get the following syntax error.

File “script.py”, line 13
age += 4
^
SyntaxError: invalid syntax

Can anybody be of any assistance? Thank you - See below the code:

1 # create the initial variables below
2 age = 28
3 sex = 0
4 bmi = 26.2
5 num_of_children = 3
6 smoker = 0

8 # Add insurance estimate formula below

9 insurance_cost = 250 * age - 128 * sex + 370 * bmi + 425 * num_of_children + 24000 * smoker - 12500
10 print(“This person’s insurance cost is” + (str(insurance_cost) + “dollars.”)

12 # Age Factor
13 age += 4

Hello @fredericstrass265676 , welcome to the forums! Check this line, and see if you can spot anything wrong with it:

Hint

Check the amount of opening parentheses( compared with the closing parentheses). They should be equal. Are they?

In Python, whenever you get a Syntax Error, always check the line of code above (in this case three lines above, since the lines directly above were a comment and an empty line).

Thank you very much all got solved had the same syntax error along the code. BR Fred

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.