We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
There's probably many other ways to do it, and I won't claim this is the cleanest way - but essentially I had to muck with 'set_printoptions(formatter=...)' before each output was displayed to adjust the formatting width to accomodate the 'width' of the largest value.
Alternatively I supposed I could have written my own 'printN' function.
I was hoping someone might be able to explain why I had this problem and it seems no one else did (or didn't comment on it).
Thanks in advance,
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Floor, Ceil and Rint
You are viewing a single comment's thread. Return to all comments →
I was wondering if anyone could help explain this.
I answered this question successfully, but the comparison kept failing due to whitespace differences with the 'golden' result.
I checked this discussion and no-one seems to have had the same problem. However, to get my code to complete I had to use the following
There's probably many other ways to do it, and I won't claim this is the cleanest way - but essentially I had to muck with 'set_printoptions(formatter=...)' before each output was displayed to adjust the formatting width to accomodate the 'width' of the largest value.
Alternatively I supposed I could have written my own 'printN' function.
I was hoping someone might be able to explain why I had this problem and it seems no one else did (or didn't comment on it).
Thanks in advance,