This is ternary
if operator. Basically this is shorthand for
if ... then ... else ...
So if your statement is true, then instructions between
: are executed. If statement is false, then instructions after
: and until line end are executed.
In your case this code can be rewritten as
if length(diff) > 0.0:
force += normalize(diff) * ...