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.
This comment is hidden because it contains spoiler information about the solution
Fair enough, that makes sense - thanks for replying!
My query was from point-of-view of 6-7 kyu Users - when I review Beta kata I just try to anticipate the most likely User's problems, while there is still time to make some modifications (many users don't always read descriptions fully!).
But re-reading tests, I just noticed you have a custom error message in the Tests with
Remember that indexing of packages starts at 1!
so that's a nice idea.In worst case, if you have many Questions in Discourse about 1-indexing, you can always add a reminder in the Solution Setup itself also.
I think @ivan_popov means that he has solved and/or unlocked solutions for kata; then he has looked at the top voted solution and attempted to solve kata with it, but finds that there is an error (due to code length).
@ivan_popov: The reason is - (Yushi.py: if you press View Solution you can see his solution) - probably that you have 3 extra "empty" lines in your current solution; try deleting those extra lines and try again submitting: those lines are counting towards the character limit.
This comment is hidden because it contains spoiler information about the solution
@tm89 - read the comments, this has been asked many times before: see the examples in these 2 comments for example
https://www.codewars.com/kata/551f23362ff852e2ab000037/discuss#63197061b80b157f805cde49
https://www.codewars.com/kata/551f23362ff852e2ab000037/discuss#633b61c8c97a6c004257ae4b
etc
Hey @samcleff99 and welcome to Codewars!
I'm not sure this is the best place to have a discussion on Python in general - it's just a random kata page O_o - but you are welcome to join the Codewars Discord channel (there is a link in the sidebar on the left): we have a #beginners channel, and also a #python channel where you can ask questions as you get started.
If you're a complete beginner and looking for book reading recommendations, I personally think that the book "Python Crash Course" by Eric Matthes is the best all-round introduction if you've never programmed before.
It's a nice kata, but I wonder if it's worth redesigning to make the output format a bit simpler/clearer:
Does the 1-indexing really add anything (I understand it may come from source Olympiad question, but are they using Fortran/Julia/APL for their questions O_o ? For Python kata why not just have it 0 indexed ?).
Or maybe why not ask to return the package values themselves? Looking at your solution checker it seems that would work also?
Hey @joey.mavity and welcome to Codewars first of all!
Your prime checking is fine/performant enough for this kata - the inefficiency is coming from your main loop.
Currently, you are always producing your entire
primes
list fromm
ton
, regardless of how early the correct solution is in that list - for example, withm = 1
n = 10_000_000
andg = 2
your approach will find all the primes up to 10_000_000, only then to notice that the gap = 2 appears between prime 3 and prime 5, so you did a huge amount of unnecessary work.So maybe a suggestion would be: can you perform the check for the gap "as you go", on an as-needed basis, without needing to always generate all the candidate primes in the given range
m -> n
Hey @Turks - like you, I spent a lot of time trying to understand the specs on this kata; so when I solved it I wrote some of my discoveries in this post here in case someone would find it useful:
https://www.codewars.com/kata/526c7b931666d07889000a3c/discuss#6395084ba673d200304fc929
so maybe some of that can help you also get started.
Well in my mind the audience was booing me and my bad ASCII <-> "I see" pun, but maybe they also don't like golfing or finding Wally :(,,, tough crowd!
ASCII what you did there @dfhwze (audience throws tomatoes, boos)
I thought it was a nice little pattern kata - I tried it for CG after seeing your comment on Dashboard ;) - and would make a good 7-8 kyu as-is.
It seems that the people who are gonna code golf solutions will code golf anyways so enforcing the CG requirements just means that it can't really be a 7-8 kyu anymore?
Hey @brodiemark - thanks so much for your comment below and the Java translation (sorry for slow reply, been AFK this week)!
I don't know Java so I can't approve it but since I saw you're in Discord feel free to ping someone in #reviewing if you don't get the translation approved in a few days (this can happen if it's not noticed on the front page immediately by an active power user in that language).
Hey @enricodallastella - no worries! I see now better what is happening - I was confused also, when I tried those tests using my Python solution. I'm guessing that your Go code is returning this solution:
[[36156, 68120], [4524, 68120], [51090, 68120]]
? This is what my old Python solution produces also.The reason for the confusion seems to be what is stated in the Note section of the kata description: "Newer translations have some reducible fractions. To be on the safe side it is better to do a bit more work by simplifying fractions even if they don't have to be."
So in the example that is causing problems, once you have obtained the above result, you may have to perform 1 more simplification step: here for example you can see that the numerators and denominator that you get are all divisible by
2
, so you can divide all the terms in the fractions - that is where the final value34060
is coming from.Hey @Ebenezer D. and welcome to Codewars!
Are you confused by the Codewars interface/environment and how to submit your solutions? There is this document here:
https://docs.codewars.com/getting-started/solving-kata/
which may be useful; alternatively you can join the Codewars discord (link in sidebar on the left) - there is a dedicated #beginners channel where you can get help starting out with the site.
But basically, you can pretend that you are working on your local PC - try to write a function that solves the given kata task, test it with a few different inputs to see if it works as you'd expect. Then you just copy paste that into Codewars and that's roughly all you have to do - Codewars will test your solution usings the test data that you can see in the bottom right of the screen, in the section "Sample Tests".
Loading more items...