5 kyu
Keep it short (with restrictions)
219suic
Loading description...
Puzzles
Restricted
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.
Funny one of the series.
The length of the user's code could be displayed in assertion messages for the "code length" test.
Updated in latest fork.
python new test framework is required. updated in this fork
Approved. Thanks!
Python new test framework should be used and 3.8 enabled
3.8 is now enabled, but new framework should still be used.
Done by saudiGuy.
How can we give the output without the return statement as print statement won't work?
There's a type of function that has implicit 'return'.
I tried everything but still I can't do anything. My code passed all the tests but it is failing in that one restriction.
Can you give me a little more help?
There's a thing in Python named after a Greek letter :)
This comment has been hidden.
There is a way to import stuff with less code, and there are ways to solve this kata without imports.
You are not required to explicitly define the function. Consider how the test will invoke your function. If only there were a Greek method for assiging a function to a word....
Also, it seems that ypur solution has 2 lines
How do you check if astring apperars in the code. I am new to codewars and i want to author a kata (mystery). Thanks a lot
Hi,
solve one (or more) of "with restrictions" katas and check the test cases :) The checks I use aren't bullet-proof. Actually they are intentionaly cheatable as the point of these kata is to get creative solutions and not to force to solve them in one specific way.
Regards,
suic
Thank you very much! But still I can't figure out how you restrict the coding of others.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
Why restricting imports or number of lines or even recursive solution? In my opinion, I find it more interesting to let only the twittable golf restriction and to let players to attempt their solution on several lines even with
return
.This comment has been hidden.
This comment has been hidden.
Hi,
thanks for the comment. Ad
import
: A one-liner containing;
is not a one-liner :) To your second point: I agree, that=
prevents recursive solutions and further optimisation but optimisation isn't the main point of this kata :)When we talk about code golf: The best code golf mission I've ever solved was the
Fibonacci Golf
on checkio.org but this mission isn't available at the moment. :( The point was to write Fibonacci, Tribonacci, Pell... number generator with smallest compiled bytecode.Regards,
suic
P. S. I might have added a different restriction:
Your code must not contain '8'.
(rofl). I may used this in the nextwith restrictions
kata. One way to say "I don't care" in Hungarian is "Nekem nyolc" (literally translated as "For me eight") which is a great title :)This comment has been hidden.
Hi, thanks for the suggestion. I've added a note about one-liner to the description. :) Regards, suic
What is the purpose of restriction 5?
This comment has been hidden.
This comment has been hidden.
Not an issue
@suic
,Your bizarre hatred for PEP8 and coding best practices in general is amusing.
In your quest to teach worst practices, you seem to have created a brand new data-structure in Python. What do you call it?
I often followed your "nice discussions" last time... I think the problem is not PEP8, but celebrating it each time - it's really a boring discussion, boring but sometimes funny to see the pep (attention, should be a wordplay;-)) you are offering your lovely PEP8. What is it - the bible what everyone has to do here (in your opinion)? Surely code should be efficient and readable with some formalism... but if someone defeats some (not too important?) formal points it should be respected or accepted after x useless discussions... Sometimes it's a kind of creativity and individualism too (especially here on codewars, which often is used just for fun and not only for best practice)...
This comment has been hidden.
I don't mean any offense, but can
@suic
and@zebulan
do this more privately? I get notifications :( I simply don't understand why "best practice" or PEP8 matters here in this kata where the goal is different, but that's just my opinion.I belive the point of this kata is to solve under given restrictions. If you don't like that, why don't you create a new one without those restrictions? You can even require PEP8. Isn't that easier than trying to convince
@suic
to do it in your way? I'll be happy to complete both :)Just out of curiousity, what does
{1: 1, 2: 2, 2: 3, 1: 4}
has to do with PEP8? Isn't that just a typo?This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
Got a "Too long" message for a 1-line. What is maximum allowed length ?
It's one-line. There's the following check:
len(solution.split('\n')) < 2
soisn't valid either but I'm not sure if this is your case.
Regards,
suic
Your comment is hidden and I've not solved the kata! ; ) ) )
Try now :)
Yep, it was an empty-line-error-code. Thx. ; ) )
Thanks for this kata :) I've been enjoying this series.
4th test case in "Basic Tests" gives a list with empty
dict
as an input:Currently accepted solutions seems to work by treating it as some iterable object?
Thanks, very good spot! This is a beginner's mistake :) It's fixed now! Regards, suic
Resolved :)
P. S.: Can you please assess the rank of the kata if you haven't done it already? Thanks, suic
Sorry, I hadn't. I tend to avoid assessing rank unless I have some rationale behind the vote, especially when I'm one of the first few. For this kata, I wasn't sure how much difficulty those restrictions added.
No problem :)
Maybe it's my lack-of-sleep talking, but having just solved it, right now I'm totally spacing out about why I might have wanted to use ; or # here. :-)
Hi,
Thanks for solving and rating it. I like the fact that there's a much less fancy way to solve this than I thought :)
You're right
;
doesn't make much sense with "two lines restriction". I've changed it to 1 line. A true one-liner mustn't include;
.#
is about "keeping it short" i.e. no comments :)Regards,
suic
Oh OK, now I remember how you can use ; in Python, that the "; = Java/JavaScript/PHP" in my head is not quite right. :-)
@tachyonlabs: Thanks for approval :) Regards, suic
You're welcome! I get a kick out of the various katas that have weird restrictions as part of their challenge, even if I can't think of ways to solve some of them ... maybe later on those ones. :-)