I’m halfway through completing the Python Syntax: Medical Insurance Project (https://www.codecademy.com/paths/data-science/tracks/dscp-python-fundamentals/modules/dscp-python-syntax/projects/ds-python-syntax-project).
After calculating the difference in insurance based on the factor age, the next set of instructions are:
We want to display this information in an informative way similar to the output from instruction 3. On the next line, print the following string in the terminal, where
XXXis replaced by the value of
The change in cost of insurance after increasing the age by 4 years is XXX dollars.
Doing this will tell us how 4 years in age affects medical insurance cost estimates assuming that all other variables remain the same.
You will need to concatenate strings and use the
The hint uses the following piece of code:
print("The change in estimated insurance cost after increasing the age by 4 years is " + str(change_in_insurance_cost) + " dollars")
However, I’ve formatted it like this:
print("The change in estimated insurance cost after increasing the age by 4 years is", change_in_insurance_cost, "dollars")
I haven’t used the
str() function to include the variable
change_in_insurance, but it doesn’t throw up a syntax error. What’s the point of using
str() if this is the case?