Hi! I am starting to learn python and got stuck in some easy(I think) trouble.
I am trying to separate lines that got the same value of X at StartPoint and EndPoints (Vertical Lines), but it seems that even though the X from Start and End points are the same, python reads them as if they were different. Can someone help me?
This is a common rounding error issue, you can do either of the following tests instead of a literal comparison…
Subtraction method…
if x1 - x2 < 0.001:
Or rounding method…
if round(x1, 6) == round(x2, 6):
Of course you can choose your own threshold of accuracy, but either should fix this problem.
4 Likes
Thanks alot for the help!
1 Like