Skip to main content
added 19 characters in body
Source Link
DialFrost
  • 5.1k
  • 2
  • 12
  • 54

Python2 - 37 bytes

g=lambda x:(x%4or x%400and x%100<1)<1

g=lambda x:(x%4or x%400and x%100<1)<1

Note that if a is a nonnegative integer, then a<1 is a short way of writing not bool(a). The last <1 thus effectively converts the expression in the parentheses to a boolean and negates the result.

Applying the function g to an integer n between 1801 and 2400 will return True if n is a leap year, and False otherwise.

Python2 - 37

g=lambda x:(x%4or x%400and x%100<1)<1

Note that if a is a nonnegative integer, then a<1 is a short way of writing not bool(a). The last <1 thus effectively converts the expression in the parentheses to a boolean and negates the result.

Applying the function g to an integer n between 1801 and 2400 will return True if n is a leap year, and False otherwise.

Python2 - 37 bytes

g=lambda x:(x%4or x%400and x%100<1)<1

Note that if a is a nonnegative integer, then a<1 is a short way of writing not bool(a). The last <1 thus effectively converts the expression in the parentheses to a boolean and negates the result.

Applying the function g to an integer n between 1801 and 2400 will return True if n is a leap year, and False otherwise.

Commonmark migration
Source Link

Python2 - 37#37

g=lambda x:(x%4or x%400and x%100<1)<1

Note that if a is a nonnegative integer, then a<1 is a short way of writing not bool(a). The last <1 thus effectively converts the expression in the parentheses to a boolean and negates the result.

Applying the function g to an integer n between 1801 and 2400 will return True if n is a leap year, and False otherwise.

Python2 - 37#

g=lambda x:(x%4or x%400and x%100<1)<1

Note that if a is a nonnegative integer, then a<1 is a short way of writing not bool(a). The last <1 thus effectively converts the expression in the parentheses to a boolean and negates the result.

Applying the function g to an integer n between 1801 and 2400 will return True if n is a leap year, and False otherwise.

Python2 - 37

g=lambda x:(x%4or x%400and x%100<1)<1

Note that if a is a nonnegative integer, then a<1 is a short way of writing not bool(a). The last <1 thus effectively converts the expression in the parentheses to a boolean and negates the result.

Applying the function g to an integer n between 1801 and 2400 will return True if n is a leap year, and False otherwise.

Source Link
mathmandan
  • 1k
  • 10
  • 9

Python2 - 37#

g=lambda x:(x%4or x%400and x%100<1)<1

Note that if a is a nonnegative integer, then a<1 is a short way of writing not bool(a). The last <1 thus effectively converts the expression in the parentheses to a boolean and negates the result.

Applying the function g to an integer n between 1801 and 2400 will return True if n is a leap year, and False otherwise.