Python SyntaxError: invalid syntax - File '<ipython-input-10-755483d6a0c5>', line 8
There are two issues with the code:
-
The multiplication operator
*is missing between(x2-x02)and(y-y0). -
The exponent operator
**should be used instead of2for squaring.
The corrected code is:
r2 = sum((x2-x02)*(y-y0))/(sqrt(sum((x2-x02)**2)) * sqrt(sum((y-y0)**2)))
原文地址: https://www.cveoy.top/t/topic/oHxT 著作权归作者所有。请勿转载和采集!