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.
I would have saved a lot of time if the compiler error messages were more clear. At first, I got an error about using str(). Then, many times I got error messages about using more than one print() or for statement. I was using only one of each, but it turns out that if a comment in the code mentioned either of those keywords, it would cause the error, too! FFS!
Finally, I got past those errors when I realized I should remove the comments. Then I got an error message about using a "string literal". I was using sep='\n' in the print() statement. Even that is considered to be "related to strings". FFS!
Anyway, my inelegant solution is…
for i in range(int(input())):
print(123456789 // 10**(8 - i) * 10**(i) + 87654321 % 10**(i))
Not as neat as the problem setter's code, but I think it's fairly unique.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Triangle Quest 2
You are viewing a single comment's thread. Return to all comments →
I HATED this challenge.
I would have saved a lot of time if the compiler error messages were more clear. At first, I got an error about using
str()
. Then, many times I got error messages about using more than oneprint()
orfor
statement. I was using only one of each, but it turns out that if a comment in the code mentioned either of those keywords, it would cause the error, too! FFS!Finally, I got past those errors when I realized I should remove the comments. Then I got an error message about using a "string literal". I was using
sep='\n'
in theprint()
statement. Even that is considered to be "related to strings". FFS!Anyway, my inelegant solution is…
Not as neat as the problem setter's code, but I think it's fairly unique.