New answers tagged

2

Avoid repeating yourself There is a lot of code duplication in your program. This means you had to type in more than necessary, and the chance of bugs getting in your code has increased as well. Whenever you find you have lots of similar sections of code, find a way to reduce that. For example, when you define P1, P2 and so on, it would be easy to make a ...


2

Since (a < 0 and b > 0) or (a > 0 and b < 0) can be summarized as a*b < 0, moreover * and < work on vectors, we get the one-liner: plt.scatter(X[0], X[1], c=X[0]*X[1] < 0)


Top 50 recent answers are included