This is a puzzles and challenges website, the very definition of "restricted by artificial rules". Would you sit down at a monopoly board and then insist that "If this were real life, I would just keep moving until I found a hotel that I considered affordable"?

Personally I did it because it's the most effective way (that I know of) and that is what programming should aim for.
And not be restricted by artificial rules.

To be mathematically rigourous, you should update how you handle the zero polynomial or the polynomial with 0 as the constant term. This polynomial should be represented by [0] not [] because the polynomial needs to have a constant term in order to exist.

I'm having some trouble with the random test cases for this kata. I can pass the basic test cases without issue, but the rule appears to differ for the random tests. For every random test, it looks like the solution is p1[x]+ 2*p2[x], while the basic test cases are just p1[x]+p2[x]
*Random examples:
[44, 89, 73, 78, 34, 34, 91, 33, 25, 13, 42, 8, 31, 36, 14, 53, 85, 82, 85]
[3, 68, 34]

This is a puzzles and challenges website, the very definition of "restricted by artificial rules". Would you sit down at a monopoly board and then insist that "If this were real life, I would just keep moving until I found a hotel that I considered affordable"?

*Jessie Pinkman "Booooo bitch" lol

Awesome!

This kata has literally nothing to do with polynomials.

It's not specified how trailing zeros in the result should be handled. Is trimming zeros considered incorrect?

These two comments are confusing. Please delete the text

"Two polynomial of order zero fail."

"Mixed length polynomials fail."

Nice use of abs value function, very pythonic, elegant one-liner.

Personally I did it because it's the most effective way (that I know of) and that is what programming should aim for.

And not be restricted by artificial rules.

How is this voted clever? It is violating the basic rule.

Not a self-contained issue

To be mathematically rigourous, you should update how you handle the zero polynomial or the polynomial with 0 as the constant term. This polynomial should be represented by [0] not [] because the polynomial needs to have a constant term in order to exist.

I think there is an issue with one of the random tests when len(p1) > len(2) > 0. In this case the test is always expecting a wrong result.

For example, these are the p1, p2 and the wrong expected result:

Test.assert_equals( poly_subtract([84, 37, 41, 12, 83, 11, 14, 67, 10, 37, 77, 45],[52, 61]), [-20, -85, 41, 12, 83, 11, 14, 67, 10, 37, 77, 45])

while the correct expected result should be:

[32, -24, 41, 12, 83, 11, 14, 67, 10, 37, 77, 45]

I'm having some trouble with the random test cases for this kata. I can pass the basic test cases without issue, but the rule appears to differ for the random tests. For every random test, it looks like the solution is p1[x]+ 2*p2[x], while the basic test cases are just p1[x]+p2[x]

*Random examples:

[44, 89, 73, 78, 34, 34, 91, 33, 25, 13, 42, 8, 31, 36, 14, 53, 85, 82, 85]

[3, 68, 34]

## [47, 157, 107, 78, 34, 34, 91, 33, 25, 13, 42, 8, 31, 36, 14, 53, 85, 82, 85] should equal

[50, 225, 141, 78, 34, 34, 91, 33, 25, 13, 42, 8, 31, 36, 14, 53, 85, 82, 85]

[23, 45, 83, 58, 32, 5, 39, 37, 3, 29, 35, 83, 12, 8, 67]

[28, 23, 56, 75, 2, 99, 15, 73, 26, 88, 76, 97, 58, 59]

[51, 68, 139, 133, 34, 104, 54, 110, 29, 117, 111, 180, 70, 67, 67] should equal

[79, 91, 195, 208, 36, 203, 69, 183, 55, 205, 187, 277, 128, 126, 67]

Approved

It's already fixed

## Loading more items...