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.
@brendanvos
Your own solution also mutates the original list passed trough the function.
Out of curiousity i tried your solution in Pycharm. I stored [1, 1, 1] in a variable x, stored 10 in varuable y, called the function with (x, y) parameters and after requested a print(x). Both the print(function) and print(x) yielded the same result.
Sorry if I'm mistaken, but aren't you also mutating the input (signature) in your solution?
When I apply this solution as tribonacci([15, 16, 14], 3) I receive [15, 16, 14] but I had in one of the randomly generated tests, that the correct answer should be [45], which does not make sense. There should be a clearer specification to what the function should do for n in [1,2,3], I guess.
You don't remember correctly. Python lists are mutable. Mutable objects are pass by reference.
If you make changes to a list which was passed in as a parameter you WILL mutate the list for the caller.
No because python should be treating anything within a function as abstracted. If I remember correctly you'd have to declare it as a global variable
good point.
You're mutating the signature despite that not being the goal of the function!
That's a no no!
My solution was EXACTLY like the top one when i unlocked solutions but it failed - so there is something wrong with this Kata's test cases - I want my honor for this one!
What is the point of these tests:
Expected: "More Than One Space Between Words", instead got: "More Than One Space Between Words"
Expected: " Leading Spaces", instead got: "Leading Spaces"
Expected: "Trailing Spaces ", instead got: "Trailing Spaces"
Especially when they aren't specified in the description nor shown in the initial test cases. You only see them when submitting answers. Why would the cases for leading and trailing spaces even require those spaces. The first is just silly; why would anyone put more than one space between words (unless a typo)?
Just some feedback and a need for clarification. Thanks!
This was a bogus kata - nowhere in the discussion does it say to leave spaces - that requirement in the test result is not fair at all.