Hello!
I’ve just started the Python Syntax: Medical Insurance Project and I’m getting a syntax error when I add the following code:
insurance_cost = 250 * age - 128 * sex + 370 * bmi + 425 * num_of_children + 24000 * smoker - 12500
The link to the exercise is here:
https://www.codecademy.com/paths/data-analyst/tracks/dacp-python-fundamentals/modules/dscp-python-syntax/projects/ds-python-syntax-project
The error message is: SyntaxError: can’t use starred expression here
I’m not sure where the error is. Has anyone else had this issue?
Thanks for your help!
Tabby 
Can you please post all of your formatted code?
Sometimes the error is above the line that’s specified in the error message.
Thanks, yes!
This is the all of the formatted code:
create the initial variables below
age = 28
sex = 0
bmi = 26.2
num_of_children = 3
smoker = 0
Add insurance estimate formula below
insurance_cost = 250 * age - 128 * sex + 370
Actually the formatting was off. It’s:
create the initial variables below
age = 28
sex = 0
bmi = 26.2
num_of_children = 3
smoker = 0
Add insurance estimate formula below
insurance_cost = 250 * age - 128 * sex + 370
Sometimes this happens when one copies the code and pastes it into the script.py window in the learning environment. Did you try to type out the asterisk (and the formula) rather than pasting it?
Here’s the post about formatting code:
https://discuss.codecademy.com/t/how-to-format-code-in-posts/51139/7a
1 Like
Thanks so much! I’ll try that.
Did you try resetting that window and then maybe try putting 370 on the next line so that line doesn’t begin with the “*”
like:
1 Like
That worked. Thank you so much!
1 Like
Whew! Good!
Sometimes it’s the smallest things. 
Right! Thanks again for your help! 
1 Like