Python Classes: Medical Insurance Project

hi, this is my code in medical insurance project


it prints “John Doe’s estimated insurance costs is 1836.0 dollars.
None”
can you explain me why there is “none”

Hello! It is because the estimated_insurance_cost function has no return. That means when you print the return value:

print(patient1.estimated_insurance_cost())

You are printing None, as there is no return value. The reason you still get the John Doe’s estimated insurance costs is 1836.0 dollars. printed is because you still call the function when you print it, which means any print statements inside it get printed.

2 Likes

thanks
i replaced print() in method to return, and it starts work without "none’

2 Likes