8 kyu
Beginner Series #1 School Paperwork
11,783 of 189,314Vortus
Loading description...
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.
This comment has been hidden.
Ооо, вот это мой уровень задач! Лол! (Бэкендер с опытом 2+ лет)
This is awefully written.
If there is nobody to do homework there are no pages required. Trying to make negatives of a real world problem is going to cause a more 'real world software problem'. You can't have negative sheets, nor can you have negative classmates.
You should error trap that into your code. if(classmates < 0 || pages < 0) { no pages are required }.....
My python solution tells me test case 5 is failing because 25 should equal 0. Ive chased the logic through my function and its hitting the return 0 line. Still it says 25 should equal 0. I wrap the entire solution in its own function and call it to print the return before returning it.
Its prints 0.
25 should equal 0.
(╯‵□′)╯︵┻━┻
Best part is if i remove everything and make the function only return 0 when called, it magically understands what 0 is now and passes on text case 5.
Don't chase "logic", chase facts. If you insert print statements everywhere, you'll be able to reason about stuff much easier.
"magically"? Really? There is no magic here, which means that your solution had a bug. Simple as that.
At some point you managed to solve the kata, but you couldn't bother to remove this bogus issue... so I'll do that for you.
Wow you're such a little pathetic asshole. You're intentionally misunderstanding what ive said so u can be a arrogant and smug.
You described literally what I did and called chasing logic but used a different word, get over yourself.
What was magical is that i can confirm my function is returning 0 by wrapping it in another function and checking its output before returning from that. But it still thinks its 25 despite printing the variable is 0 before returning.
You could have helped me understand why my function returns 0 but reads 25, instead you're so smug you cant accept this was a real issue...
You did two things wrong:
One of the above makes you eligible for a short vacation.
How could I? The only code that I could see (because obviously you provided none) is one that passed all tests, and it had no print statements either. So no, I couldn't magically prove that 0 is actually 25.
All I could see is that you're chasing ghosts, just like in the rest of your comment.
НЕПОНЯТНО
Lua translation!
Approved
I think the instruction is incomplete, cuz it dosent says you should multiply it if it is not 0.
If it is 0 and you multiply it, what do you get?
I dont know how to solve this
This is the place were i learned to use question marks, THANK YOU :D
easy
too easy))
Это задача для тех, кто только начинает изучать программирование.
In js I get undefined, although I have checked it in the browser's console and the code works. Whoever has written it please fix it mate, thanks.
We do not know why your solution returns
undefined
, we would have to see your code.How is this a real situation/problem to solve? It makes no sense with what info we are given.
easy, fast and funny
The SQL translation is missing table description which makes the kata a little longer to solve as you have to read it form the test case or select the table and test it.
This is in the initial code as a comment:
You have there the table and its columns's names, do you need anything more than that?
how can you have negative classmates? nonsense!
That was the comment i was going to make, you mind reader :'C
This comment has been hidden.
Soo I have been able to solve this kata in R with the same implementation but in javascript I seem to recieve a "undefined while the expecteed is 25" altho I used a console.log instead of "return" and the console do log 25 but the test still returns "undefined".
Easy and understandable kata. Good one
alright. I have no idea what this one wants from me.
Scala translation
LGTM, Approved!!!
This comment has been hidden.
Please don't post solutions in Discourse. Discuss solutions in Solutions section and you can see yourself other solutions there too.
RISC-V Translation
Approved
Updated C Translation
Approved
Thanks!
This comment has been hidden.
Test Results: Fixed Tests Basic Test Cases (5 of 5 Assertions) Completed in 0.08ms You have passed all of the tests! :)
so by having that show up it should mean my code passes right??
Your code is wrong and it randomly passes the tests.
It doesn't do that. Those 5 tests are the sample tests.
Added a single fixed test and 50 random tests with small values to Python.
This doesn't make any sense. How do I calculate? With a calculator? I know absolutly nothing a about Javascript and it gives no instructions on what to type and then context on what any of it means. Seriously, what do I do?
Can you guys start running these descriptions through GPT-4 or something so they are semi-legible? Half these katas have descriptions like "If eat goes 4 down then art was do less than Tom saids leak."
I feel like I'm having a stroke.
Your comment brightened up my day!
We are engineers. We are supposed to be able to figure it out
oalah ternyata m karo n kudu ada kondisi baru kebaca
weeeh baru liaht aya jelma indo di codewars
kak maksudnya gimana
This comment has been hidden.
Please don't post solutions in Discourse again, thanks.
.
Thanks for the info. I will mark all my post with spoiler.
I'd prefer you don't post your solution in Discourse, if all were doing the same, then it'll be a nightmare and not very useful to anyone.
Thanks for the note. I will not post any solution here in discourse again.
Thanks, make sure you read this if you have some doubt on how to proceed when your code doesn't work: https://docs.codewars.com/training/troubleshooting. Cheers.
This comment has been hidden.
This is my first ever question and I was using "Print" instead of "Return" and failing all of my test cases. It makes me sad that I missed out on points because of this little SNAFU. :)
Are you really wanna say this CASE clause in SQL is for 8 kyu?
In SQL La consegna dice di restituire tutta la tabella, tuttavia se si restituisce l'intera tabella il test andrà in errore perche la tabella opriginale contiene anche la colonna id. Bisognerebbe cambiare la consegna rimuovendo l'indicazione di ritornare l'intera tabella, esplicitando solo le colonne che realmente il test richiede
Fixed, please write in english next time.
This comment has been hidden.
This comment has been hidden.
Not a kata issue, this is what I get when running your solution, which is correct
Hi. The original Java code template seems to be in C-style, while common Java convention is to have first curly bracket at the end of the first line of a method declaration.
https://www.cs.cornell.edu/courses/JavaAndDS/JavaStyle.html#Indentation
NASM translation
I think the description needs to be adjusted here. The scenario of having "negative" people or "negative" pages makes no sense in the real world. The kata doesn't mention the possibility of that happening either, you only find out once you've tested it.
On the contrary, it is explicitly mentionned in the description.
Lol my thoughts exactly
Это на случай, если ошибочно введены отрицательные значения.
My first attempt on SQL translation, please review and approve carefully
Approved
My first attempt on COBOL translation, please review and approve carefully
approved
Missing sample tests for negative numbers in several languages
Missing fixed tests for 0 in PHP
Added three sample tests to test for invalid cases, so that users can get helpful information from running the test.
Approved
R translation
Typescript translation
(author inactive)
Thanks :)
This comment has been hidden.
Julia translation
easy
Got a bit tripped up, these easy katas always have some trick :)
Crystal translation kumited :) (author inactive)
This comment has been hidden.
Hey moderators, there are a handful of outstanding translations, and the author is away for a few years now. Can you please review and approve?
let's gooooo, finally done
using 'n' and 'm' as parameters is poor craftmanship. DONT USE MEANINGLESS PARAMETERS! something like "participants" and "sheetsPerPerson" would aid in readability.
Also when would you ever get a negative number of sheets or participants? If these are edge cases you should highlight them in the question (or tests if you want to be sneaky). It doesn't make sense.
Otherwise, not a bad effort.
Good advice. I was struggling to remember what they were for until I changed them myself :/
This comment has been hidden.
Please read this: https://github.com/codewars/codewars.com/wiki/Troubleshooting-your-solution
Your if condition is wrong.
The expected and actual values of the assertion in the PHP version are in the wrong order. This leads to errors that might confuse the beginners this kata is aimed at.
Fixed.
For java: (5, -5) ist not really an option there. Why should the paperwork, ever, be -5? Pls fix.
That validation is part of the task.
Pascal translation.
Approved.
This one was quite fun, mainly by the fact that I've seen a totally unexpected solution for me as a begginer.
I made a pretty fun solution for this really easy kata, https://www.codewars.com/kata/reviews/55fa902836589109b40000af/groups/5f6cb67c3b23e00001be83c8 :)
Translation for portuguese(br).
Descrição:
Seus colegas de classe lhe pediram para copiar alguns trabalhos. Você sabe que tem um número de colegas 'n' e o trabalho tem uma quantidade de páginas 'm'.
Sua tarefa é calcular quantas páginas em branco você precisa.
Exemplo:
paperwork(5,5) == 25
Nota: Se o n < 0 ou m < 0 retorne 0!
This comment has been hidden.
lacking the final
}
does quite literally cause aSyntaxError
. add that onto your code and it will passThis comment has been hidden.
Please, don't post solutions in Discourse. It's not allowed.
Sorry, I didn’t know. how to delete my comment?
After it has a reply, you can't, but you can still delete the other one
In javascript the number of random tests should be fixed, not random, and there are no random tests with negative numbers.
Should be fixed in all languages.
How isn't this a duplicate of Multiply except that if the numbers are positive, return 0?
The primary difference is that the Multiply kata is a bug-fixing challenge (ie. correct the incorrect code) whereas this one requires the user to start from (nearly) scratch, hence making it slightly more difficult. Still similar enough to be considered a duplicate IMO.
I see
Solution setup for Elixir is missing the defmodule macro.
fixed
I agree that should be for positive numbers only, but I suppose a better acceptance criteria should be defined. The problem is related to people and pages, should we expect in real world to have a to have a negative number of these?
Also, don't you need m-1 copies for m people?
No, because you (the owner of the original) aren't in those m people.
This comment has been hidden.
VB Translation available
it was do easy, thank you friend =))
CFML Translation :)
Prolog translation kumited. (author inactive)
This comment has been hidden.
"if n or m < 0 return 0!"
You should remove the exclamation mark from the description, as it appeared that you had to return "0!" instead of 0
Done.
Agree with some of the comments below about more tests. A test including a negative number would ideal!
More test cases would be ideal, though I was very happy with the instructions.
There are already random tests.
Better description to take into account negative numbers please.
Seems like fixed
This comment has been hidden.
Seems like fixed
This comment has been hidden.
Seems like fixed
This comment has been hidden.
Not an issue
Little wonky with the idea of negative students
Not an issue
"Note! if n or m < 0 return 0! Waiting for translations and Feedback! Thanks!"
This note at the end of the description gives the impression that the code should return "0! Waiting for translations and Feedback! Thanks!" if something is < 0. You might want to consider removing this or updating the code to match this result.
Fixed.
Great Kata but description could mention the inclusion of negative inputs in the test cases.
Done.
CoffeeScript added
'alr approved some time ago'
Kata instructions could be more detailed. Some issues popped up only after submitting and seeing the various test cases fail...
Not an issue
There wasn't any explination in the description about the possiblity of negative values. Seeing as how the description was a real work problem, there wouldn't be negative students or papers. Otherwise easy test, good for beginners.
Not an issue
This comment has been hidden.
ok i will adjust it
Not an issue
Poor description
Not an issue
It seems strange to have negative numbers in the tests given the scenario.
Not an issue
Poor description.
Not an issue
I am getting a result that says "expected: 0, instead got: 0" It passes for the number 0+ but for numbers <0 I get this and I am positive my program works because I have tried it in an external environment so I am not sure why this won't accept my answer.
Fix up grammar in the instructions.
Seems like fixed
It is natural to assume a class cannot have fewer than 0 students, the kata should clarify that it can.
Seems like fixed
It's very simple and I think that you didn't necessary tests'
Not an issue
explain how to handle wrong input
Seems like fixed
so easy
Not an issue ;-)
Nice and simple Kata :)
However, I think your C# version needs more test cases.
You description talks about people, and paper, but the tests check for negative values. How can you have negative people or paper? A better description, including the possability for negatives would make sense.
You always have to deal with wrong input values, even if they don't make sense. At my university quarter of all test cases are just handling bad inputs.
While dealing with negative values in this problem is indeed arguable, now appropriate note has been added to the description.
when you test it says ok for n*m, but any other errors only show on submit (such as <0, or syntax problems).
Seems like fixed
additional tests to pass in some unexpected values would be beneficial.
You should add more tests to run.
Wording of the n or m < 0 doesn't make sense.
Seems like fixed
It was fine and easy. Just wish the test cases and instructions were clearer. I did this kata very quickly (even as a beginner) but I did it around my failed tests.
Seems like fixed
The example doesn't make sense with the test cases. You can't have negative people or people that need a negative amount of papers. I would suggest modifying either the test cases or the example or stipulate that the answer should handle erroneous input.
Seems like fixed
Confusion about tests...
You really can't have -n or -m so it makes it hard to figure out what you've done wrong. Would maybe recommend mentioning that in the test description as newcomers such as myself may not know you're trying to re-enforce coding defensively...
I am using the Javascript version of this test...
Added.
If grammar is important to you, below are some suggested changes to "Your task is to calculate how much blank pages do you need."
"Calculate how many blank pages you need." "Calculate how much paper you need." "Your task is to calculate how many blank pages you will need."
If you care about grammar way too much, like me, here are the reasons for the suggestion: Proper usage is "many" where things can be counted ("How many pieces of cake are you gonna eat? Many pieces") and "much" when they are not countable("How much cake are you gonna eat? Soooo much cake.").
The phrase "do you need" is not a big deal, but most native speakers would only use it in a question, "do you need x pieces of paper?" or "how much paper do you need?" and would use something like "you will need" or simply "you need" in this case.
Seems like fixed
This comment has been hidden.
Maby someone stole them from you. Duh. Its just that i think beginners should know how to prevent program from unexpected results and input.
Neither n nor m can ever be less than 0 in your scenario "You know that there are 'n' classmates and the paperwork has 'm' pages."
Ok you got, me ill fix it. Still i think there should be negative tests for beginners.
Ideally yes, however as this is a real world example, you need to apply real world logic.
However I would suggest Randomised tests.
Agreed. Just change the example to be clear that you can have negative values, and it's fine.
Seems like fixed
This comment has been hidden.
Fixed it! Thanks man!
JS translation kumited.