Spacing between operators


In many of the exercises I don’t get it cleared because I would type for example

def rental_car_cost(days):
if days>=7:

and the ideal answer is with spaces between operators as in

def rental_car_cost(days):
cost = 40 * days
if days>=7:
cost -= 50

It doesn’t throw up any errors but it’s just not exactly the same as the exercise’s answer and thus not correct. But do these spaces between operators matter?


Because Codecadamy parses your code it does matter in this case.

In general it does not matter tho. This does not mean you should remove spaces when using operators tho. Using spaces in between operators makes code easier to read. Its a good habit to have and the next programmer that looks at your code would be thankful.