print it to the console, then copy/paste
This comment is hidden because it contains spoiler information about the solution
I'm also with the same solution
Maybe you have modified the input arrays.
bare excepts are a good example of what not to do. So this is exactly NOT best practice.
I agree on both counts; catching exceptions is good and handling expected states is great.
In case of negative index it's definitely the best practice.
Nope! Code grouping is done by an algorithm.
FYI: Instead of True if condition else False you can write condition or (if condition is bool-ish and the return type must be boolean) bool(condition).
True if condition else False