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.
Read the description carefully
"contiguous subsequence" is not a mistake, it's a shortcut to say all elements of the subsequence are contiguous in the sequence.
and since no-one wants to guess at indentation, use proper markdown formatting
Hi, don't post code without the spoiler tag or everyone can see it (I have added the tag).
This comment is hidden because it contains spoiler information about the solution
doesn't "elif n is None:" cover that tho?
You need to handle the case when no argument is given.
def arr(n):
x = []
if n == 0:
return []
elif n is None:
return []
else:
for i in range(n):
x.append(i)
return x
'''
Traceback (most recent call last):
File "/workspace/default/src/codewars-test/codewars_test/test_framework.py", line 111, in wrapper
func()
File "tests.py", line 7, in basic_tests
test.assert_equals(arr(), [])
TypeError: arr() missing 1 required positional argument: 'n'
'''
I don't understand the error with my code above.
There are strings with non-ASCII characters in Rust. There are no such characters in other languages and it's not possible to solve this task in general without detailed specifications (can there be decomposed characters? characters that aren't mapped one to one when changing case? what language/locale is it? "I" needs special handling in Turkish, "Σ" needs special handling when it's the last letter...)
It means that your solution does not work when called like this:
hello()
i.e. without parameters.It should work when called with either one param (
hello("Steve")
) or without params (hello()
).I still can't figure it out...
Read the posts below asking the same.
What does the following error mean?
Traceback (most recent call last):
File "main.py", line 14, in
test.assert_equals(hello(), "Hello, World!")
TypeError: hello() missing 1 required positional argument: 'name'