7 kyu
First thing first.
441reivhax
Loading description...
Debugging
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.
Got me thinking for ages, very clever.
dumb kata, not sure what it's supposed to teach. The test responses are useless and unhelpful as well.
So obviously you need a language feature I don't know about yet. What is it? Closures? Doing 2 hours of blind research is just not appropriate for a 7 kyu to me.
No, nothing that fancy, no. You know you can forfeit and see the solutions if you give up, don't you?
Forfeiting is not an option to me, I just try to solve it later when I come back smarter (hopefully).
I tried setting a default in the args (that would call the function for initialization?) but that's forbidden because of the
=
.Next I would play around with a decorator (which also is kinda fancy). Maybe first yield, then return? But yield stops the execution. Still a lot of confusion and stuff to try.
However, your slight hint gave me motivation, thanks!
That's ok too, sometimes, leaving it for later is for the best. I'm pretty sure a facepalm will happen when you solve it ;) .
The issue below is still not fixed.
Python 3.8 should be enabled.
Resolved
Please, don't close issues without doing anything.
"We'll the purpose"
fixed
This comment has been hidden.
I can detect changes in the global scope. But I guess that is also bypassable by using the local scope instead.
i'll block eval and exec. Thankyou
Half fixed. There is still the issue of getting the user's code as a string. So, currently any variable declarations or calls to eval or exec outside the solution function is not detectable.
Yes, it is detectable :) when you scan the
solution.txt
** file instead of using theinspect
module. (check these with restrictions katas)** This can be cheated too, but IMO sofisticated cheats are fun :)
@suic how is it cheatable?
Maybe by encoding the code in some way then decoding and executing it. but how will this be possible with the eval and exec functions blocked?
solved. thanks :-)
I know at least 2 approaches: with a module (can't remember which one), and with plain Python, although that'd require tricks smarter than the kata itself.
@reivhax: I can't find that solution and I can be mistaken (as my memory isn't the best) but I've seen at least one sofisticated "workaround" for
solution.txt
check. Regards, suicOk, no worries. by the way, thanks for sharing the restrictions collection. Its really helping me.
This comment has been hidden.
This comment has been hidden.
The current anti-cheat is not very good. You're right, this should not be allowed.
This is what i feared. can anybody help me to get the user's source code as a string? After a lot of research I was only able to use the inspector module to get the code in the solution function.
This comment has been hidden.
Thank you @FArekkusu. Codewars should include this in their tests readme on github.
This comment has been hidden.
I have reviewed the issue. Once again, thank you.
Solved. :-)
This comment has been hidden.
Thank you so much. I have reviewed this issue and fixed the bug.
No random tests
The functionality of the code is static. How would random tests apply?
The key to be returned is randomized.