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.
Having the same issue as RONAEED but don't quite understand the suggested advice to fix this?
This comment is hidden because it contains spoiler information about the solution
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 solution for this Kata in Python returning an error
"Traceback:
in
in
NameError: global name 'string' is not defined"
despite passing all the previous test cases, and not using a variable named string in the code.
Can someone take a look at my code for me please?
My bad! Should be
len(pin) != 4 and len(pin) != 6
. Thanks Unnamed.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.This comment is hidden because it contains spoiler information about the solution
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
My code rejects strings of wrong lengths and invalid characters, but then fails the first real example. Could somebody have a look at my code?
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.
This comment is hidden because it contains spoiler information about the solution
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
my python 3 code passes all the random number examples, but fails 3 of the first 5 examples - could someone have a look at my code?
This comment is hidden because it contains spoiler information about the solution
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.
Loading more items...