#! /usr/bin/env python # def weekday_to_name_common ( w ): #*****************************************************************************80 # ## WEEKDAY_TO_NAME_COMMON returns the name of a Common weekday. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 20 August 2015 # # Author: # # John Burkardt # # Parameters: # # Input, integer W, the weekday index. # 1 <= W <= 7. # # Output, string S, the weekday name. # name = [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ] # # Return the weekday name. # s = name[w-1] return s def weekday_to_name_common_test ( ): #*****************************************************************************80 # ## WEEKDAY_TO_NAME_COMMON_TEST tests WEEKDAY_TO_NAME_COMMON. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 20 August 2015 # # Author: # # John Burkardt # import platform print ( '' ) print ( 'WEEKDAY_TO_NAME_COMMON_TEST' ) print ( ' Python version: %s' % ( platform.python_version ( ) ) ) print ( ' WEEKDAY_TO_NAME_COMMON returns the name of a day of the week' ) print ( ' in the common calendar.' ) print ( '' ) print ( ' Index Name' ) print ( '' ) for i in range ( 1, 8 ): name = weekday_to_name_common ( i ) print ( ' %5d %s' % ( i, name ) ) # # Terminate. # print ( '' ) print ( 'WEEKDAY_TO_NAME_COMMON_TEST' ) print ( ' Normal end of execution.' ) return if ( __name__ == '__main__' ): from timestamp import timestamp timestamp ( ) weekday_to_name_common_test ( ) timestamp ( )