Pure Programmer
Blue Matrix


Cluster Map

Project: Ordinal Date

Write a function to compute the ordinal date. The function should have arguments for month, day and year. Use preconditions to validate the function arguments and postconditions to check the result. There are two different ways to compute the ordinal date. One is to directly compute it using min() and max() (See [[Ordinal date]]). The other is to precompute the days prior to the beggining of a month and store the results in an array.

Output
$ python3 OrdinalDate1.py 2 22 1732 2/22/1732 = 53 Ordinal Date $ python3 OrdinalDate1.py 3 1 1900 3/1/1900 = 60 Ordinal Date $ python3 OrdinalDate1.py 3 26 1963 3/26/1963 = 85 Ordinal Date $ python3 OrdinalDate1.py 8 5 1993 8/5/1993 = 217 Ordinal Date $ python3 OrdinalDate1.py 3 1 2000 3/1/2000 = 61 Ordinal Date

Solution