Seymore4Head <Seymore4Head@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 > <cut> > > 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 variations. -- DaveA -- https://mail.python.org/mailman/listinfo/python-list