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.
Seems like your solution managed to pass in the end.
There is no such test, and it should be false. (it could be one of random tests tho)
Hi, unless you can show some evidence that the kata is broken, please don't post as an
issue
, otherwise you can post as aquestion
. In this case, the reason you get this error message is that the kata expects the funtion name to belikes
, whereas your function name isdigitize
.This is where you need to start debugging your solution. The first step is to print the input, so even if you fail a test, you can see what the input for that test was. Then you can try to manually go over your code, step by step, to follow along with what it is doing. If you did, you would realize that your code never hits the return statement in some cases. This happens when return statements are buried in some conditional; if the conditional is never True, then the return statement is likewise never executed.
Now, Python functions
always
return something. In the absence of a return statement, functions simply returnNone
.Tests usually output something like "x should equal y", where
x
is your answer andy
is the correct answer. Your code only returns a single number, and after hitting a return statement the function ends. Please look carefully at the test output. As I said before, your code will returnq
as soon as it encounters an odd number:if its_odd < 2: ...
, which istrue
the first timec
is odd.I'm sorry but I don't quite understand what your problem is; could you copy and paste the exact input and test result?
Your code formatting seems off (indentation matters), but from what I can tell it seems your code will return the index of the first odd number it encounters.
Please don't post solutions to the discourse. Use the
spoiler
flag if you really must.