Skip to main content
deleted 1 character in body
Source Link
Dennis
  • 210.6k
  • 41
  • 370
  • 825

Pyth, 11 bytes

!%|F_jQ*TT4

This full program read from STDIN and prints True for leap years and False otherwise.

Thanks to @Jakube for suggesting Pyth and basically porting my CJam code.

Verify the test cases yourself in the Pyth Compiler/Executor.

How it works

     jQ*TT   Returns the evaluated input in base 10 × 10.
  |F_        Swaps the digit order and reduces using logical NOTOR.
             So far, we've achieved 1954 -> [19, 54] -> 54 || 19.
!%        4  Returns the logical NOT of the result modulo 4.
             This prints True for multiples of 4 and False otherwise.

Pyth, 11 bytes

!%|F_jQ*TT4

This full program read from STDIN and prints True for leap years and False otherwise.

Thanks to @Jakube for suggesting Pyth and basically porting my CJam code.

Verify the test cases yourself in the Pyth Compiler/Executor.

How it works

     jQ*TT   Returns the evaluated input in base 10 × 10.
  |F_        Swaps the digit order and reduces using logical NOT.
             So far, we've achieved 1954 -> [19, 54] -> 54 || 19.
!%        4  Returns the logical NOT of the result modulo 4.
             This prints True for multiples of 4 and False otherwise.

Pyth, 11 bytes

!%|F_jQ*TT4

This full program read from STDIN and prints True for leap years and False otherwise.

Thanks to @Jakube for suggesting Pyth and basically porting my CJam code.

Verify the test cases yourself in the Pyth Compiler/Executor.

How it works

     jQ*TT   Returns the evaluated input in base 10 × 10.
  |F_        Swaps the digit order and reduces using logical OR.
             So far, we've achieved 1954 -> [19, 54] -> 54 || 19.
!%        4  Returns the logical NOT of the result modulo 4.
             This prints True for multiples of 4 and False otherwise.
Source Link
Dennis
  • 210.6k
  • 41
  • 370
  • 825

Pyth, 11 bytes

!%|F_jQ*TT4

This full program read from STDIN and prints True for leap years and False otherwise.

Thanks to @Jakube for suggesting Pyth and basically porting my CJam code.

Verify the test cases yourself in the Pyth Compiler/Executor.

How it works

     jQ*TT   Returns the evaluated input in base 10 × 10.
  |F_        Swaps the digit order and reduces using logical NOT.
             So far, we've achieved 1954 -> [19, 54] -> 54 || 19.
!%        4  Returns the logical NOT of the result modulo 4.
             This prints True for multiples of 4 and False otherwise.