Beta
Unicode Math
21zebulan
Loading description...
Unicode
Fundamentals
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Please use new python test framework.
Guess I share Voile's point of view: this kata - and especially the notion of implicit values of a unicode string - is too vague to be considered helpful. There are litterally too much possibilities to extract a value out of unicode values, and no visible example or clean description to put warriors on the right path.
I understand your point, trying to describe this task without pointing the answer, but at the moment, description nearly doesn't give any hint at all.
An interesting example that you can put in the description is:
This should allow players to grasp what you intend by implicit value of a unicode character without spoiling too much.
@lechevalier
,I have added your example to the description.
Thanks for the downvote!
Let's see if this example alone is sufficient; in that case, I will update my vote.
@lechevalier
,Your comment doesn't make much sense since this kata has only had
22(oops!) 9 people finish it in a year. Who exactly are you expecting to come along and find it "sufficient" (at the bottom of the Beta kata list)? All you've done is push it even farther down hahaIn fact, 22 people try to complete this kata, only 9 succeeded: you should ask why there are so few completions. Anyway, you should expect this kata to be validated sooner as it only needs one more completion to proceed.
@lechevalier
,My mistake, thanks for pointing out the typo! Unfortunately, it makes my point even stronger.
Laziness? Finding a function in the Python standard library is easy, even you managed to do it.
I don't mind if this kata doesn't get approved, it was just a quick attempt to share something I learned with others.
Thanks for your time!
Well... That was useful... But that was painful... :o
Maybe you should add a comment/hint about where to find the "trick" to convert the "weirdest unicodes" (I'm not used to handle unicodes. I spent a long time searching for a way to convert things like
\U0001420a
or something like that...)This comment has been hidden.
This comment has been hidden.
@Blind4Basics
,My goal with this kata was to try and help people learn something new (which it seems like you did!) but I never intended for it to take that long to solve. My katas are far from perfect but I just thought it was something I hadn't seen used in a kata before so I tried to contribute back to Codewars.
That's a great idea, I'll add that link to the description now! Hopefully that will help people learn something new and be able to solve this kata in a reasonable amount of time.
Thanks for the suggestion!
cool thing! :)
This comment has been hidden.
@Voile
,The kata is called "Unicode Math" and has two other mentions of "unicode" in the description.
There was a specific reason for me not to use that word, feel free to enlighten yourself by reading the other comments.
Thanks for another well thought out comment!
This comment has been hidden.
@Voile
,The amusing part is how much trouble you seem to have had with such a simple kata.
In one of your example tests, unicode_math(u'a1b2', [lambda a, b: a - b]) == -1
Am I supposed to skip the a & b, leaving a 1 & 2 hence 1 - 2 = -1?
@daddepledge
,Yes, the
a
andb
dont have the "implicit values" needed for the mathematical operations. So yes, in that case1 - 2 = -1
.Sorry about being so vague, I just couldn't figure out how to word the description without giving away the answer! I'm open to suggestions though, let me know if you have any!
Thanks. I have the 6 example tests working, but no more than that. Could you add some more tests to the examples, so I could see the unicode strings (I lack the skill to print these beasts out I think) - or is that the idea of the Kata?
@daddepledge
,I purposely chose those particular example tests not only to show what was expected but to try and trick people into taking a particular path. I thought it might be a good learning opportunity for people to bump into that "wall" and then realize there must be another value associated with unicode characters.
I had the same printing issues but I just moved on after having such little interest shown towards this kata (only 16 people have attempted it in 3 months). I will try again tonight to see if I can simplify printing the unicode strings for both versions of Python.
Thanks for trying out this kata!
Found the answer, which took me some time. Thanks. I think the 'wall' is a useful learning tool.
@daddepledge
,Congratulations on finishing it!
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
@Micromind
,I tried writing a function that would print for whichever version of Python a user chose. Python 3 still has an issue.
As a test, I added the
unicode_print
function call above each random test to help a user while debugging.Basic Tests
and nowhere elseI'm open to any suggestions on how to get them back to printing above each test as expected but I'm still stuck without proper printing at the moment. Anyways, I will keep trying to fix it.
Thanks for your help!
@zebulan,
since the print-statement does that automatically, did you try to add a linebreak (
'\n'
) at the end of each string?@Micromind
,EDIT:
I added a newline character at the end of the Python 3 version (using
stdout.buffer.write
) and it does make a difference by splitting up each line, so thanks for that point!The main issue remains though. All of the random test lines are printed above the first
test.describe('Basic Tests')
in a single "Log" output box. They are not printed above each random test (that's where the "unicode_print" function calls are). In other words, there is almost no easy way to associate them with each particular random test.OK, next try:-)
The following part for python3 seems to be working for me as intended:
This comment has been hidden.
For the first issue, can you try and put the flush before
sys.stdout.buffer...
. It seems that there are two different buffers for stdout at work here, that have to be flushed in the correct order.The second issue I don't understand at all. I've seen it during some tests exactly once yesterday and once today, but so far I can't reproduce it. Usually I get the correct unicode symbols.
After a quarter of a hour, I have no clue about how to work on the last example case: any hint in that regard? As Unnamed mentioned, the first part is not very clear to me.
The meaning of "character values" is not obvious at all. Is it intentional?
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.