sunshine@lemmy.ml to Programmer Humor@lemmy.mlEnglish · 2 days agoI'm new to using Ruby and this tickled me pinklemmy.mlimagemessage-square87linkfedilinkarrow-up1262arrow-down17
arrow-up1255arrow-down1imageI'm new to using Ruby and this tickled me pinklemmy.mlsunshine@lemmy.ml to Programmer Humor@lemmy.mlEnglish · 2 days agomessage-square87linkfedilink
minus-squaremrgoosmoos@lemmy.calinkfedilinkEnglisharrow-up11·1 day agolook I’m not trying to be a dick or anything, but do you not know about leap years and which years they are?
minus-squarecomfy@lemmy.mllinkfedilinkarrow-up1·edit-22 hours agoedit: just realized it was the python and not ruby example, I was very tired and distracted when I was reading this thread.
minus-squareKazumara@discuss.tchncs.delinkfedilinkarrow-up5·edit-28 hours agoLeap years are each fourth year, except each hundredth year, except each thousandth fourhundredth year. 1896 leap year 1900 not leap year 1904 leap year … 1996 leap year 2000 leap year 2004 leap year … 2096 leap year 2100 not leap year 2104 leap year Then you just arrange the 10 year window in different positions to overlap 1 to 3 leap years to reveal the three outcomes of the bug. - / - - - / - - - / - - / - - - / - - - - - 0 - - - / - - - - is a normal year, / is a leap year, 0 is an exceptional non-leap year.
minus-squaresexybenfranklin@ttrpg.networklinkfedilinkEnglisharrow-up2·15 hours agoSmall correction, it’s every fourth year except every hundreth year except every 400th year. I’m assuming the misconception comes from the last time it was a 100th also being a 1000th (2000) but the next time a leap year will end in 00 is 2400
look I’m not trying to be a dick or anything, but do you not know about leap years and which years they are?
edit: just realized it was the python and not ruby example, I was very tired and distracted when I was reading this thread.
Yes, and I have no idea…
https://youtu.be/-5wpm-gesOY
Leap years are each fourth year, except each hundredth year, except each
thousandthfourhundredth year.1896 leap year
1900 not leap year
1904 leap year
…
1996 leap year
2000 leap year
2004 leap year
…
2096 leap year
2100 not leap year
2104 leap year
Then you just arrange the 10 year window in different positions to overlap 1 to 3 leap years to reveal the three outcomes of the bug.
- / - - - / - - - /
- - / - - - / - - -
- - 0 - - - / - - -
- is a normal year, / is a leap year, 0 is an exceptional non-leap year.
Small correction, it’s every fourth year except every hundreth year except every 400th year. I’m assuming the misconception comes from the last time it was a 100th also being a 1000th (2000) but the next time a leap year will end in 00 is 2400