Leap year

Dave Angel davea at davea.name
Sat Sep 27 11:07:11 CEST 2014

Seymore4Head <Seymore4Head at Hotmail.invalid> Wrote in message:
> Still practicing.  Since this is listed as a Pseudocode, I assume this
> is a good way to explain something.  That means I can also assume my
> logic is fading with age.
> http://en.wikipedia.org/wiki/Leap_year#Algorithm
> I didn't have any problem when I did this:
> if year % 400 == 0:
> 	print ("Not leap year")
> elif year % 100 == 0:
> 	print ("Leap year")
> elif year % 4 == 0:
> 	print ("Leap year")
> else:
> 	print ("Not leap year")

But the first two prints are incorrect, so I'm not sure what you
 mean by "didn't have any problem."

Incidentally, it's usually easier to test a function that does one
 thing. So if you replace all those prints with appropriate return
 True or return False, then it's easy to exhaustively compare two


More information about the Python-list mailing list