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.
True or False obviously. But in Python True also equals 1, and False equals 0.
This solution is not intended for production or readability (although I find it readable okay). I was just having fun and exploring how to write down logic with minimal overhead symbols and concepts. Consider tuple a way to substitute a switch statement.
P.S. I am not a professional dev either.
g modifier: global. All matches (don't return on first match)
i modifier: insensitive. Case insensitive match (ignores case of x or o)
This comment is hidden because it contains spoiler information about the solution
This solution was written in Python 2. It does not work because Py2 is deprecated. It needs certain adaptation to Py3 to work with the test cases again.
Yes, that's right. Because this solution was written in Python 2. In Py2 filter() returned different thing. In this case, it returned a string.
This is a spoiler and it actually is bad behaviour to spoil solutions in Discussion. Sometimes you need to discuss it, then you should click the spoiler tag. In this case this seems absolutely unnecessary. Why are you doing this?
I added randomized tests according to your design in Python as an additional block in the end. I hope this satisfies you (at least for Python).
Yes, I think you guessed right. If
f
is an empty filter object (list(f) == []
), then in Python 3bool(f)
returnsTrue
which is why you do not get what you expected.Third line checks if there are any columns, rows or blocks which are not a set of numbers from 1 to 9.
Second line helps define blocks.
Does this help you? You can ask more specific questions if you are missing something.
If I remember right, the solution was written in Python 2. In that version of Python zip() returns a list. In Python 3 zip() returns a zip object instead, so you will need to convert it into list in order to concatenate it with lists.
board + [*zip(*board)] + blocks
can help resolve this.This comment is hidden because it contains spoiler information about the solution
Feel free to design an advanced spinoff of this puzzle though where this may be important.
Citing the kata description:
aug is an integer, percent a positive or null floating number, p0 and p are positive integers (> 0)
Why catch errors when they are not expected by definition?
I edited sample tests. Please check if I resolved the issue, your message is somewhat unclear to me.
Loading more items...