#! /usr/bin/env python # def l4_xor ( l1, l2 ): #*****************************************************************************80 # ## L4_XOR returns the exclusive OR of two L4's. # # Discussion: # # An L4 is a logical value. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 21 November 2015 # # Author: # # John Burkardt # # Parameters: # # Input, bool L1, L2, two values whose exclusive OR is needed. # # Output, bool VALUE, the exclusive OR of L1 and L2. # value = ( ( l1 and ( not l2 ) ) or \ ( ( not l1 ) and l2 ) ) return value def l4_xor_test ( ): #*****************************************************************************80 # ## L4_XOR_TEST tests L4_XOR. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 21 November 2015 # # Author: # # John Burkardt # print ( '' ) print ( 'L4_XOR_TEST' ) print ( ' L4_XOR computes the exclusive OR of two L4\'s' ) print ( '' ) print ( ' L1 L2 L4_XOR(L1,L2)' ) print ( '' ) for l1 in ( False, True ): for l2 in ( False, True ): l4 = l4_xor ( l1, l2 ) print ( ' %5s %5s %5s' % ( l1, l2, l4 ) ) # # Terminate. # print ( '' ) print ( 'L4_XOR_TEST' ) print ( ' Normal end of execution.' ) return if ( __name__ == '__main__' ): from timestamp import timestamp timestamp ( ) l4_xor_test ( ) timestamp ( )