Pull it together
I just did the lesson from scratch and passed. Error messages don’t always point to the error, and SCT messages are limited. Any error in the code could result in the same message.
Look for ways to simplify your code and don’t add things that are not suggested or asked for in the instructions. This can lead to unexpected code patterns that the SCT will reject out of hand.
rate = 40
first victim of cutbacks. Try instead a single expression that computes undiscounted cost…
cost = days * 40
total variable is not asked for and in truth is excess verbiage. If you’re not going to do any further computation, then declaring a variable before returning it is wasteful and totally unnecessary. That sort of code is easy to trim.
cost is it should be a simple matter to apply the discount directly in the conditional, if one applies. Depending which school of thought you are expected to apply, either return the discounted amount immediately, or discount the amount and store that, then return it at the end of the function.
return cost - 50
cost -= 50
The choice is yours.