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.
Can someone please explain what we're supposed to do? (english is not my first language) or atleast point me in the right direction?
No problem. For starters, you can take a look at the Authoring examples to see & mimic how others structure the tests.
If you have any questions, you can ask here / Discord#help-translate / consult the Codewars Documentation.
Translation Authoring Guidelines
Authoring Python Content
Alright thank you! I am new here and this is my first time translating. I am not sure how I was supposed to go about it..
Rejected due to various issues in this translation:
Missing sample tests
Missing random tests
User solution is imported incorrectly
Translation to Python
added to the descriptionFeel free to fork this again, once you have fixed the issues above.
This comment is hidden because it contains spoiler information about the solution
W3schools article of functions might help you
Understood, Thank you.
If you don't know what that means do some research.
Traceback (most recent call last): File "/workspace/default/.venv/lib/python3.11/site-packages/codewars_test/test_framework.py", line 112, in wrapper func() File "/workspace/default/tests.py", line 14, in basic_test_cases test.assert_equals(how_many_light_sabers_do_you_own(), 0) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: how_many_light_sabers_do_you_own() missing 1 required positional argument: 'name':
The basic test cases seem to have a problem (?) (Langugue: Python) My code passes all test except this one and this is the error I get when I run it. Even when I remove my code and just return it without any values (ie. pass) this issue still remains. I do not know whether I should mark this as an issue.
Thank You. That was a really concise explanation.
In a class, there are three types of methods: instance methods, class methods, and static methods. Instance methods are defined with a mandatory parameter
self
, alongside any other required parameters. For class methods, we use the@classmethod
decorator before the method and include a mandatory parameter namedcls
, along with other parameters. Static methods, on the other hand, don't require a decorator and function like normal Python functions without needing a mandatory parameter. When written within a class, they behave as static methods by default, but you can add clarity by using the@staticmethod
decorator. Remember it's common practice to use decorators and highly recommended.Why did you use @staticmethod on top of all the functions? (I am a newbie so pardon my questions)
In your problem I don't think you need a constructor(you can pass) for your given tasks.
I didn't think of that. Nice one.
Ah..My bad. Thank you.
Loading more items...