Retired
Days in the year (retired)
4,394 of 8,820alwinsol
Loading description...
Date Time
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.
Greetings! Can anyone explain me why I'm getting a message 'You cannot submit your solution because the kata is retired.'?
You are getting this message because this kata has been marked as retired a couple of days ago, and retired kata do not accept solutions.
Thank you!
I'm getting the below error, I've been testing it for quite a while and it doesn't look like its properly tested for negative numbers in JS.
Should work for random years: expected '-800 has 365 days' to equal '-800 has 366 days'
As terrible as this kata is, this test case seems to be correct as far as the requirements go: -800 is evenly divisible by 400, so it
isshould be treated as a leap year, and have 366 days.Я думаю, что это не 8 ката, а 7 ката
That's an opinion, not a kata issue. Ranks can't be changed anyway (with very few exceptions).
Please use English on this platform (use a translator if you need to).
Rust translate
Kata retired.
its really very tricky.
Lovely Program i enjoyed it a lot, wishing you the best!
Fairs nuf
Ignoring that this is very blatantly a duplicate and should never have been approved, what the hell -
That reads like nonsense. What. Are. You. Talking. About?
You could start with "this is" or like, "hi", or something.
integers? as opposed to what? bananas?
plural. there's more than one rule.
how even english
if you're going to use fancy words then the rest of the text needs to not be broken.
where's the unpublish button?
Fixed.
Weird. Failed Python test even on PC it works correct as per task. Test failed only with 300. It divides by 4 it means it should be 365 days but it shows me 366 should be instead. ok. But why other attempts failed.
if you get an error message, read it.
javascript tests are wrong for the negative century years.
Can you elaborate on this issue?
How many days are there in the year 100 / -100 / 400 / -400 respectively?
Exception: Century years are NOT leap years UNLESS they can be evenly divided by 400.
This comment has been hidden.
The example section in the description should be rewritten to be language agnostic
my solution sometimes says -1400 is a leap year
Fixed.
This comment has been hidden.
python new test framework is required. updated in this fork
Approved
Javascript updated to Node v18.x
Please use
chai
module for assertions and notassert
.You can use
assert
class fromchai
though.Fixed for this update.
It would be nice if the description said something about what the return value of the function/method was supposed to be.
It's really an issue, but I labeled this as a "suggestion" because the kata is 6 years old and will probably never get fixed.
Done.
Ruby 3.0 should be enabled.
Kata retired.
Python 3 should be enabled.
This comment has been hidden.
This comment has been hidden.
Not an issue
Actually there was no Gregorian Calendar before 1582 (see https://en.wikipedia.org/wiki/Gregorian_calendar).
How about adding another rule to throw exceptions when year < 1583?
True, that is a new kata and not this one as it is simple.
How is there a test for year 0 when there isn't a year 0 in the calendar?
As stated in the kata year 0 is an assumption made.
Should't year -300 have 366 days in test cases? It's definitely a leap year like years 300, -304 and -296.
This was in the exception, Century years are NOT leap years UNLESS they can be evenly divided by 400.
Yes it's true, but this is only for this kata needs if I understand it right. Couldn't the test case for "year -300" be fixed from "365 days" to "366 days"(so the instructions) to match the real life(and exclude weird exceptions), so the code counting leap years pass the tests?
This is following the rules and so will not be changed.
Leap Year Definition. A year is a leap year if it is evenly divisible by 4 but not evenly divisible by 100 unless it is also evenly divisible by 400. So 1996 was a leap year. But 1900 was not a leap year because, although it is divisible by 4, it is also divisible by 100 and not by 400. 2000 is a leap year because it is divisible by 400.
I'm not sure that rule applies correctly to BC dates. Not having a year 0 would offset the rule by 1 year. The correction wasn't implemented in BC and therefore any testing of it for negative dates is not valid.
From the kata "There are a few assumptions we will accept the year 0, even though there is no year 0 in the Gregorian Calendar."
I can return the correct number of days in the year as a string (in JS), yet this somehow doesn't seem to be enough... Is there something I have missed?
What are you doing?
Are you adding a year as an integer and then returning that interger in a string?
For example if I enter 2000 as the integer in the function, 2000 is a leap year then the following is returned
2000 has 366 days
If I enter 2001 as the integer in the function, 2001 is not a leap year then the following is returned
2001 has 365 days
Thank you for your help.
Can anybody please explain me the question with more details? I am not exactly understanding the question.
A year has 365 days, a leap year has 366 days. If it is a leap year display 365 days. If it is a leap year display 366 days.
The noted exceptions (centuries not divisible by 400) are not tested in the test cases (at least in python). Thus, my incomplete solution passed without error...
Yeah, the kata got approved too soon. Again.
I think that a contributor shouldn't be able to approve a kata.
At least half the random test cases should have been numbers ending in -00, but actually I made a mistake compared to the (correct) Ruby version of it, generating only multiples of 400. Plus I added a fixed test case about them in both languages.
Thanks for your feed :)
Thank you Giacomo for amending
However, the JavaScript variant expects a string. Unless you actually want a string, which should be stated in the description. A string as return type is a little bit strange, though.
Wasn't "as an integer" referred to "given"? But I concur that it could have been worded better.
I have amended the wording of the kata
Actual examples would be even better, e.g.
Thank you, I will include this in the future.
Random test cases fixed (you forgot to multiply
Math.random()
, so you always got0
out of aMath.floor()
) and translated into both Python and Ruby, if you wish to approve them :)I do approve them a nice concise answer. Thank you
Inconvenient as it may be, there's no year 0 in the Gregorian calendar. 1 AD is preceded by 1 BC.
Actually, year numbers are expressed by ordinal numbers. It's not year one but the first year, so it makes sense. I think it might make sense to encode 1 BC as 0, 2 BC as -1 etc., although I don't think it's an accepted convention, so it should be explicitly stated so in this case.
Thank you. I have amended the description to state that this kata will accept 0.
Especially allowing year 0 makes this problem even worse. The Proleptic Gregorian Calendar (PGC) has no year 0. So what year does that value reference? The year before 1AD was 1BC and that was not a leap year. If you map each year
n
of your calendar to the yearn-1
of the PGC, the formula for leap years becomes tricky. IMHO the best solution would be to assert that the input toyear_days
will never be0
.Random test cases broken atm, but LOL @ the new kata with the biggest number of one-liner I ever saw around here :D
Thank you Giacomo :-)
In my oppinion, this is duplicate of http://www.codewars.com/kata/526c7363236867513f0005ca.
Thanks acraileanu. Yes its a variation of the same kata with a slight difference which includes some concatination of the int value used by the function. So not quite a duplicate
This comment has been hidden.
Thank you very much