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.
If you used a
loop {}
construct instead of the for loop, you wouldn't need the unreachable(0, 0, false)
case, since aloop {}
that never terminates has the never type (!
) which Rust can automatically coerce to any other type.This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
I'm having the exact same problem, my solution does work with 1 tho, my solution fails for the second test case, it just says "Value is not what was expected".
From a Python interpreter session with my solution:
I don't see anything wrong with this.
On Python, you can check the function's code object:
calculate.func_code.co_consts
contains all constants (numbers) used in the code. A simple check would beif 2 not in calculate.func_code.co_consts: test.fail()