00:01
And this problem, we want to print out a list of leap years, years that have a leap day.
00:09
I'm going to end up using a string, so i'm going to say answer string, and i'm going to start off by making it an empty string.
00:21
And i need to keep track of how many i've done, because as soon as i get 10, i want to start a new line.
00:32
And so i'm going to start with four year in range.
00:41
And they want us to do the year 2001 through the year 2100, so i'll put 2101.
00:49
Always want to put one more right there for the in order for the for loop to actually include 2100 when it's cycling through the different numbers.
01:02
I'm going to start, if you know anything, about leap years.
01:06
One, you should know it's a leap year occurs every four years, but if it's an even numbered year, take that back.
01:13
If it's a, if it's a century, like 2 ,100, 2 ,200, 2 ,300, there's no leap year.
01:21
There's another exemption of that.
01:23
Let me write this first, though.
01:24
So if year, modulus, 100, so if i divide it by 100 and i have a remainder of zero, that means the year is exactly divisible by 100.
01:38
I am not going to do anything because the year 2100 is not a leap year.
01:44
If we were doing a wider range of numbers that included the year 2000, we would have to include the fact that every fourth hundred years, you do get a leap year.
01:56
2000s a leap year, 2400 will be a leap year, et cetera.
02:00
More information that you want, i'm sure, but i'm going to press on.
02:03
The one that we're expecting if year divided by, if the remainder when i divide year by 4 is equal to 0, that means it's a leap year.
02:17
I'm going to say answer string, let's say plus equals.
02:26
I'm just going to add onto it.
02:28
I'm going to convert the year to a string.
02:35
And i want to put spaces between...