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.
So smart to add the lines to both the top and the botom of the diamond at the same time
@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
Very readable. I was so close :( . why the need for semi-colons though?
Smart!
Agree.
good point.
You're mutating the signature despite that not being the goal of the function!
That's a no no!
That's right
But if we'll look at tests again we'll see only strings (and lists of strings) as arguments... so IMO we should consider this tast as "strings"-exercise. And treat the task widly, like with real life tasks. IMO again.
Thanks for your solution anyway.
the problem statement did not state that the case you described should return true. I think it's a safe assumption that the author only wanted a True to return if there was an exact match in the list, and false if there are only partial matches or no match at all.
Very clever, but...
In case of a string='bye' and a list=['bye bye'] it will return False