Sep-11-2019, 01:29 PM
(This post was last modified: Sep-11-2019, 01:44 PM by YoungGrassHopper.)
(Sep-11-2019, 08:08 AM)perfringo Wrote:(Sep-11-2019, 07:20 AM)YoungGrassHopper Wrote: Thanks for in interesting info perfringo , now I can lecture about leap years too
This knowledge is 'needed' in assignments because there are several sort of limitations (can't use built-in modules etc). 'Normal' way of doing it would be using built-in modules like calendar etc.
If it's a homework then there are (probably) automated tests which (probably) will use built-in modules which return correct leap years. So code will not pass if leap years are not calculated correctly. Professors also very often try to mislead students by providing test sample which seems general but actually is specific case (as with year 2000 in this example). That's why I called it 'critical thinking'. Been there, done that
Thanks for the advice I really appreciate it perfringo. Its makes a whole lot of sense, I too think its important to maintain a critical thinking mindset.
So to get back to my piece of code , in order to make it technically sound I will need to print a phrase that states: This program will give a false positive on all centurial years which are NOT exactly devisable by 400.
Because I have no clue how to work such a fail safe into the code. My coding toolbox is vary sparse still.
I know about the "or" function but I think that only allows me to enter one condition for example:
if (years %4 == 0)or(years%400 == 0):But then the centurial years divisible by 100 is still going to produce a false positive and I do not know to to account for that in the code apart from printing a phrase that states they(centurial years exactly divisible by 100) will produce a false positive.
Even if I could attach another "or" I am not quite sure how to state it. I think I need an "Unless" function next to the "or"
Do you perhaps have a suggestion?