There's nothing more humbling than finishing a performance kata and then seeing all the elegant solutions ;_;
Enabled in this fork
Amazing and wonderful kata.
This comment is hidden because it contains spoiler information about the solution
You're welcome, glad it helped debug a bit.
I have further edited my comment now to remove all code-related info, that way it doesn't spoil for other users.
I did not see this zero because in the basic test, exactly the same without a zero, thanks :D
As the IndexError suggests, you are trying to access an index which "doesn't exist": In your code, you have a part where you write:
res = ...
(I have hidden the rest, so I don't have to spoiler this comment; I hope it is clear what I mean.)
Take this entire expression, and print it to console in the line before calling that res = ... line:
So add this print statement:
print("TEST -->>> ", ### here insert the expression you are using to find res ### )
You will see what is going wrong in your console - for input [48, 9, 3, 0, 67] you will reach a point where you get:
[48, 9, 3, 0, 67]
TEST -->>> ['']
This then fails when you use the following code later on in your program:
str(i)[0] <--- what happens if index 0 does not exist?
str(i)[0]
thanks, I misunderstood the condition
Because there is only one 0 and one 5 there? You should use the digits of the number 105881.
As 937 * 113 = 105881 and the largest palindromic number that can be arranged from the digits of result is: 81518
why answer not 105501?
Create a function that finds the largest palindromic number made from the product of at least 2 of the given arguments.
I already told you how you get the number, it's not using all the arguments. See the last example.
Result should be made from nums of the product or it should any number be up to the product?
But there is no "8"s in 451165470, or maybe I misunderstood the kata
Loading collection data...
There's nothing more humbling than finishing a performance kata and then seeing all the elegant solutions ;_;
Enabled in this fork
Amazing and wonderful kata.
This comment is hidden because it contains spoiler information about the solution
You're welcome, glad it helped debug a bit.
I have further edited my comment now to remove all code-related info, that way it doesn't spoil for other users.
I did not see this zero because in the basic test, exactly the same without a zero, thanks :D
As the IndexError suggests, you are trying to access an index which "doesn't exist": In your code, you have a part where you write:
res = ...
(I have hidden the rest, so I don't have to spoiler this comment; I hope it is clear what I mean.)
Take this entire expression, and print it to console in the line before calling that
res = ...
line:So add this print statement:
print("TEST -->>> ", ### here insert the expression you are using to find res ### )
You will see what is going wrong in your console - for input
[48, 9, 3, 0, 67]
you will reach a point where you get:TEST -->>> ['']
This then fails when you use the following code later on in your program:
str(i)[0]
<--- what happens if index 0 does not exist?This comment is hidden because it contains spoiler information about the solution
thanks, I misunderstood the condition
Because there is only one 0 and one 5 there? You should use the digits of the number 105881.
As 937 * 113 = 105881 and the largest palindromic number that can be arranged from the digits of result is: 81518
why answer not 105501?
This comment is hidden because it contains spoiler information about the solution
I already told you how you get the number, it's not using all the arguments. See the last example.
Result should be made from nums of the product or it should any number be up to the product?
But there is no "8"s in 451165470, or maybe I misunderstood the kata
Loading more items...