Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
The Tao of Programming right here
I've done 3 kata's now. This solution is enough to convince me to finally learn regex. 😠Amazing and elegant solution!
you will know later to never change the inputs given.incase u need to then make a copy of them
The res variable is unnecessary I think since the signature variable can definitely be used for the tribonnaci operation and for the return with some rejigging
keep on seeing you in the katas that I do! Keep it going!
I agree with your statement here, especially when it comes to error handling (although it's not specified in this kata).
The one line solution seems alot more clean and cool but it's definitely not best practice. Thanks for breaking each section down to the nitty gritty.
suggested tags:
combinatorics, permutations
the error is in your code, at this line:
You create a brand new
EmptyList()
for no reason there, you can reuse the current one insteadNot an issue. The tests are correct, but not the user's code. (see Kacarott's comment)
My solution still works in 3.11.
I suspect OPs solution fails due to using float-division (
result.append((numerator/denominator)*multiplier)
) instead of integer division (with//
).The issue you describe is highly unlikely, and I would rather expect it to be a problem with how your solution handles precision of intermediate values. I am inclined to believe that loss of the precision comes from a bug in your code. We could verify this if you post your solution here (remember about code formatting, and the spoiler flag!).
Python is written with solutions that seem to work only on an older version of python with lower number precision. Low numbered answers are correct, but large numbers in the 10^25 territory fail the test values as written.
I was able to pass the JavaScript test cases using the same algorithmic approach.
Beautiful. Any suggestions(anyone) on getting better at thinking more like this. Having some mental blocks lately.
Removing linebreaks like this is very poor practice, as it make the code much less readable. Also, PEP8 states that four spaces, not two, should be used for indentation.
bruhhhh why i didnt think like this
Loading more items...