Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,360 --> 00:00:07,080
All right guys in the next lesson I've got a leap year coding challenge for you and this is a really
2
00:00:07,140 --> 00:00:13,320
interesting challenge although it is a little bit challenging but it's really cool because have you
3
00:00:13,320 --> 00:00:19,470
ever wondered what makes a particular year a leap year and what makes another year not a leap year.
4
00:00:19,860 --> 00:00:23,720
And it's easy enough to say that every four years it's a leap year.
5
00:00:23,910 --> 00:00:30,690
But if you just got given a random year and you had to work out if it was a leap year then there's actually
6
00:00:30,780 --> 00:00:33,090
rules that you can follow to figure this out.
7
00:00:33,690 --> 00:00:42,630
So the rules are that on every year that is evenly divisible by four it's a leap year except every year
8
00:00:42,630 --> 00:00:45,060
that is evenly divisible by 100.
9
00:00:45,120 --> 00:00:45,460
So it.
10
00:00:45,720 --> 00:00:53,640
So if it's divisible by four but it's divisible by 100 then it's not a leap year unless that year is
11
00:00:53,700 --> 00:00:57,210
also evenly divisible by 400.
12
00:00:57,240 --> 00:01:03,280
So the rules are a little bit complex but it might be easier if you look through some of the examples.
13
00:01:03,300 --> 00:01:09,840
So for example if we wanted to figure out whether if year 2000 is a Leap Year 2000 divide by four divides
14
00:01:09,870 --> 00:01:12,460
cleanly 500 with no remainder.
15
00:01:12,660 --> 00:01:17,580
So it's a leap year when we divide 2000 by 100 then it's 20.
16
00:01:17,610 --> 00:01:19,290
So it also divides cleanly.
17
00:01:19,290 --> 00:01:27,420
So it's actually now not a leap year but but but 2000 divide by 400 equals five with no remainder.
18
00:01:27,420 --> 00:01:34,740
So finally it actually is a leap year and you can look through the different examples and also look
19
00:01:34,740 --> 00:01:42,030
at and also if you scroll down you can take a look at this Web site of known leap year and they show
20
00:01:42,030 --> 00:01:48,780
you step by step each of the rules that we talk through just now and you can test different years such
21
00:01:48,780 --> 00:01:56,070
as the year 2000 and you can see it step by step to see how they figured out whether if it is a leap
22
00:01:56,070 --> 00:01:56,880
year or not.
23
00:01:57,360 --> 00:02:02,730
Now I also recommend actually watching this video that I linked to up at the top.
24
00:02:02,940 --> 00:02:08,970
If you're not familiar with the concept of leap year and even if you do understand leap year it's still
25
00:02:08,970 --> 00:02:15,600
a fantastic video to really understand how we're adjusting for a mismatch in the Earth's rotation with
26
00:02:15,690 --> 00:02:16,730
the seasons.
27
00:02:16,770 --> 00:02:22,800
So I recommend taking a look at the video reading through each of these statements and taking a look
28
00:02:22,800 --> 00:02:28,950
at the known leap year and the Web site that it links to and then to start thinking about how you would
29
00:02:29,010 --> 00:02:30,600
write this logic.
30
00:02:30,600 --> 00:02:37,890
Now in order to map out the logic I recommend creating a flowchart of your own on drawdown IO and to
31
00:02:37,890 --> 00:02:42,420
use the flowchart to see how your code should flow.
32
00:02:42,450 --> 00:02:48,260
Now if you want a little bit of extra help I'm about to reveal the flowchart that I've created.
33
00:02:48,360 --> 00:02:54,720
If you want to first try to create your own and see if you get it right then pause the video now.
34
00:02:54,720 --> 00:02:55,040
All right.
35
00:02:55,050 --> 00:02:57,690
So let's take a look at the flow chart that I created.
36
00:02:57,690 --> 00:03:02,760
If you click on this link in hint number three you'll be taken to a page that looks like this.
37
00:03:03,120 --> 00:03:10,050
And so if we map out those rules and we click start we see is it clearly divisible by four.
38
00:03:10,260 --> 00:03:16,530
If no then it's definitely not a leap year but if it is then we have to check the next thing is it cleanly
39
00:03:16,530 --> 00:03:18,370
divisible by 100.
40
00:03:18,420 --> 00:03:18,960
No.
41
00:03:18,960 --> 00:03:20,670
Well then it's definitely a leap year.
42
00:03:20,730 --> 00:03:22,500
But if it's yes then we have the check.
43
00:03:22,500 --> 00:03:26,580
The final thing is it cleanly divisible by 400.
44
00:03:26,610 --> 00:03:28,240
If yes then it's a leap year.
45
00:03:28,320 --> 00:03:30,080
If no it's not a leap year.
46
00:03:30,390 --> 00:03:35,310
And that flowchart basically translates these three lines of logic.
47
00:03:35,400 --> 00:03:40,890
Now if English is not your first language then I recommend to take a look at the flowchart and also
48
00:03:40,890 --> 00:03:44,670
take a look at the rules for leap here in your own language.
49
00:03:44,670 --> 00:03:50,400
But once you're happy that you understand what's going on then it's time to tackle the challenge and
50
00:03:50,400 --> 00:03:51,870
write your code.
51
00:03:51,870 --> 00:03:59,910
Now remember you have to output exactly the words leap here full stop or not leap here.
52
00:03:59,940 --> 00:04:06,580
Full stop and look at the capitalization and where the spaces and full stops go that way when you check
53
00:04:06,580 --> 00:04:07,300
solution.
54
00:04:07,350 --> 00:04:10,320
It'll actually be a partial code if everything is correct.
55
00:04:10,860 --> 00:04:14,460
So head over to the next lesson and tackle this challenge now.
5615
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.