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.
did you erase the first lines of the initial solution?
I suppose that the import is needed by the sensei's code for the test. Put it there again, that should be good.
My bad! Should be
len(pin) != 4 and len(pin) != 6
. Thanks Unnamed.This comment is hidden because it contains spoiler information about the solution
A couple errors:
1.) The first 'if' statement is incorrect because Python doesn't support disconnected boolean statements. By this I mean that you have to change it to
len(pin) != 4 and len(pin) != 6
. Your code always returns False because the first part may be false, butor 6
will always be true since6
is truthy.2.) The second 'if' statement is incorrect because
i
variable hasn't been declared. You have to loop through the string using a 'for' statement usingi
as a temporary loop variable. The 'if' statement can be contained in the 'for' loop.Sure. Just post your code to this comment and use Markdown to format it, see here: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code-and-syntax-highlighting
You need to return the Boolean value instead of a string representation of the Boolean. The tests are only passing because they act on whether the return value is truthy or falsey. A non-empty string is truthy and therefore the function is truthy, thus meaning the test passes.
return True
instead ofreturn 'true'
return False
instead ofreturn 'false'
Also, you need to use backticks (`) to format your code, not quotation marks.
Sure, just reply to this comment and post your code in Markdown using two sets of three backticks, see here: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code
That specific type error occurs when you try to compare values with different data types (such as 5 < "5").
It might because you're comparing a None type (description states
It's your duty to verify that n is a valid positive integer number. If not, please, return false (None for Python)
). None type doesn't have a value you can compare with and therefore gives an error.If you are still getting errors, just post your code and I'll help ya.