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.
Exponentiation is right-associative.
I am sure this has probably been brought up before... but You CAN do the calculation with a calculator... it's not an unreasonably large number. The numerical value of this argument: ([4, 3, 6] comes out to 68719476736. That expected result should be 6. Why is this Kata's expected ouput wrong?
" ([4, 3, 6], 4)) .
This comment is hidden because it contains spoiler information about the solution
You're reading the code of tests wrong. What you see there is a list of test cases, where each test case is a tuple of
(input_list, expected)
. If you read tests further, you see:You can see that the call looks like:
last_digit(test_input)
, wheretest_input
is a single, flat list. One list from the whole test set, one by one.In the kata description it says this: E. g., with the input [3, 4, 2], your code should return 1 because 3 ^ (4 ^ 2) = 3 ^ 16 = 43046721.
that looks like a list to me! It did not mention anything about arguments being in the form of both lists or lists within tuples ! why was this information left out?
The above picture you posted is not at all nested lists. More like tuples that have lists in them.
No matter what I do to handle this (I used a recursive function to "flatten" the list), but no matter waht I do, I cannot get ([0,0,0],0) to return the expected 0. It always returns a 1.
Are these not nested lists? The arements have arrays within the lists! lists within lists.
What do you mean, "arguments that hare nested lists"? There should be no nested lists anywhere. Why do you think that you are given nested lists as inputs?
My comment on this kata is that the description is a little mis-leading! Nowhere in the description does it mention that testing will include arguments that hare nested lists! Therefore my current solution gets errors. Does this solution require recursion?
See this fork with an explanation.
This brevity amazes me... it seems like the most efficient solution (though perhaps not as readable) but I do have one question that puzzles me. How does this regular expression determine if the length of s is even or odd? How does it know that it only needs to add a "_" character if the last pair character pairing in the string is solitary?