Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
code help
#2
(Jun-13-2019, 09:41 AM)callanlove Wrote: Note that leap years occur every four years, and during a leap year the month of February has 29 days instead of 28.

Despite the fact that this is homework there shouldn't be outright wrong statements. Leap year is not occurring every fourth year.

From wikipedia leap year article you can find correct algorithm for calculating leap year:


Quote:The following pseudocode determines whether a year is a leap year or a common year in the Gregorian calendar (and in the proleptic Gregorian calendar before 1582). The year variable being tested is the integer representing the number of the year in the Gregorian calendar.

if (year is not divisible by 4) then (it is a common year)
else if (year is not divisible by 100) then (it is a leap year)
else if (year is not divisible by 400) then (it is a common year)
else (it is a leap year)
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply


Messages In This Thread
code help - by callanlove - Jun-13-2019, 09:41 AM
RE: code help - by perfringo - Jun-13-2019, 10:38 AM
RE: code help - by callanlove - Jun-13-2019, 10:45 AM
RE: code help - by perfringo - Jun-13-2019, 10:51 AM
RE: code help - by kotter - Jun-13-2019, 11:47 AM
RE: code help - by buran - Jun-13-2019, 12:32 PM
RE: code help - by jefsummers - Jun-13-2019, 01:26 PM
RE: code help - by perfringo - Jun-13-2019, 02:05 PM
RE: code help - by jefsummers - Jun-13-2019, 03:13 PM
RE: code help - by perfringo - Jun-13-2019, 04:15 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020