Created
September 27, 2012 19:58
-
-
Save briandailey/3796133 to your computer and use it in GitHub Desktop.
Revisions
-
briandailey revised this gist
Sep 27, 2012 . 2 changed files with 1 addition and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +0,0 @@ This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ is_leap_year = lambda x: x % 400 == 0 or (x % 100 != 0 and x % 4 == 0) -
briandailey revised this gist
Sep 27, 2012 . 1 changed file with 4 additions and 19 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,21 +1,6 @@ def is_leap_year?(year) return true if year % 400 == 0 return false if year % 100 == 0 return true if year % 4 == 0 false end -
hassanshamim revised this gist
Sep 27, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,7 +9,7 @@ This will return true if the year is a multiple of 400. Otherwise it returns ni --Working version -- def leap_year?(year) if year % 400 == 0 true elsif year % 100 == 0 -
hassanshamim revised this gist
Sep 27, 2012 . 1 changed file with 14 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,4 +5,17 @@ def leap(year) true if year % 400 == 0 end This will return true if the year is a multiple of 400. Otherwise it returns nil. --Working version -- def leap_year?(year) if year % 400 == 0 true elsif year % 100 == 0 false elsif year % 4 == 0 true else false end -
hassanshamim created this gist
Sep 27, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ def leap(year) false true if year % 4 == 0 false if year % 100 == 0 true if year % 400 == 0 end This will return true if the year is a multiple of 400. Otherwise it returns nil.