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.
It gives this weird error on the second random test. Don't ask me why.
Traceback (most recent call last):
File "/workspace/default/.venv/lib/python3.11/site-packages/requests/models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/json/init.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
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 75, in random_tests
expected = referance(f"https://www.wikidata.org/wiki/Special:EntityData/Q404.json")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/default/tests.py", line 59, in referance
data = refsession.get(url).json()['entities']
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/default/.venv/lib/python3.11/site-packages/requests/models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
You need to put a bit less faith into AI, because it very often gets things wrong. You also need to learn to talk to it properly, because this skill is critical to get correct information from AI. For example, I asked it:
And it answered:
In Python, the string
"hello"
typically takes 49 bytes of memory.Breakdown (in CPython 3.11, on a 64-bit system):
str
object overhead: 49 bytes (includes metadata like length, hash, etc.)So,
"hello"
(5 ASCII characters) fits in the compact ASCII representation.Total: 49 bytes.
You can confirm with:
So while it might get the calculation wrong (49 instead of 49+5=54), it is able to understand a properly asked question and account for many factors affecting the answer. The question you asked was taken out of context (it was missing critical information that it asks about a byte size of a Python object), and AI interpreted it in more general way, considering only characters, because it's the most common interpretation for this kind of questions.
Using AI is a skill, and it's very helpful to learn how to use AI effectively.
At work, developers constantly complain about clients giving unclear instructions. And now look at this — 90% of Katas fail on random tests because critical info is missing from the task description.
It’s driving me absolutely mad!
🤬
Check out this gem of a task — so confusing even an AI stumbled:
-- do you see how "hello" is 54 bytes?
-- That’s a fun observation — but the word "hello" is definitely not 54 bytes. Let’s break it down:
Each character in "hello" is typically 1 byte in UTF-8 or ASCII encoding.
😂
Lua translation
to make the issue extra clear in case anyone is trying to fix this:
there is a fixed test mentioned in the description for entity Q42 that expects:
but it seems that this wikidata entry was modified since the kata creation, and as per the rules the correct answer should now be:
The description should be fixed too.
duplicate of this issue (the label for the Q42 fixed test is outdated)
duplicate of this issue (the label for the Q42 fixed test is outdated)
Memory size, not byte size.
'Hello':
Byte size (size of the string in UTF-8 encoding): 5 bytes
Memory size (total memory occupied by the string in Python): 54 bytes
Will do. Just made a quick edit that includes printing the pattern length, as the python version does.
Thanks, approved!
I don't know C#, so please check back in a few days to see if there are any issues with it.
Cheers
Csharp Translation has been published.
Is there en version of label? Can't find it
Haskell translation
This comment is hidden because it contains spoiler information about the solution
Loading more items...