Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,680 --> 00:00:10,370
All right, welcome back to additional exercise in our programming course, who we are getting better
2
00:00:10,370 --> 00:00:12,920
and better every hopefully every day.
3
00:00:13,180 --> 00:00:18,410
OK, so what this exercise is all about.
4
00:00:19,430 --> 00:00:19,910
All right.
5
00:00:19,910 --> 00:00:23,570
So we are talking about recursions and this exercise.
6
00:00:24,490 --> 00:00:31,330
As well as probably the next one are going to be pretty much the same or not the same, but they are
7
00:00:31,330 --> 00:00:37,000
going to be very similar, but actually different, OK, because you will have to think what is the
8
00:00:37,000 --> 00:00:43,990
difference in their solution, although the question is going to be pretty much very similar, but the
9
00:00:43,990 --> 00:00:46,910
solution has to be very precise.
10
00:00:47,320 --> 00:00:53,080
So with that being said, I hope you already grab something nice to bring beforehand.
11
00:00:53,080 --> 00:00:58,420
And let's start our practice, our recursion practice.
12
00:01:00,080 --> 00:01:10,690
OK, so what do we have to do now is to write a recursive recursive function that will calculate and
13
00:01:10,690 --> 00:01:13,870
return the total number.
14
00:01:14,050 --> 00:01:26,050
The total number are the total total number of occurrences or occurrences of even numbers in a sequence.
15
00:01:26,240 --> 00:01:35,050
OK, so once again, we will have a sequence of numbers that the user will specify, OK, up until this
16
00:01:35,050 --> 00:01:37,840
stopping condition, up until minus one.
17
00:01:38,260 --> 00:01:45,580
So the user is going to insert different numbers one after the other and we are going to read it and
18
00:01:45,730 --> 00:01:53,510
to calculate what is the total number of occurrences of even numbers in this sequence.
19
00:01:54,010 --> 00:01:57,670
So, for example, let's make something simple.
20
00:01:58,450 --> 00:02:04,480
For example, we have this sequence like one, three, four, six.
21
00:02:04,630 --> 00:02:12,970
OK, then for this sequence, the function, this recursive function, basically with this stopping
22
00:02:12,970 --> 00:02:20,890
condition for this sequence, the function should return the value of two and why we want to return
23
00:02:20,890 --> 00:02:27,480
the value of two, because we know that one is not even three is not even four is even.
24
00:02:27,520 --> 00:02:35,170
That's why we have at least one even value in our section when we read the next element.
25
00:02:35,170 --> 00:02:38,550
And that six six is also an even number.
26
00:02:39,070 --> 00:02:45,000
That's why we know we have two two even numbers in this sequence.
27
00:02:45,970 --> 00:02:49,510
So the minus one will be used for the stopping condition.
28
00:02:49,510 --> 00:02:56,530
And then like we've seen it previously, we are going to make some recursive calls, recursive functions
29
00:02:56,530 --> 00:02:57,670
and so on and so forth.
30
00:02:57,940 --> 00:03:07,660
We are going to receive finally the number of the total amount of numbers which are even in this sequence.
31
00:03:08,600 --> 00:03:17,810
So I hope the instructions are clear and let's start working, try it on your own and only then watch
32
00:03:17,840 --> 00:03:18,740
the solutions.
33
00:03:18,830 --> 00:03:19,820
Good luck, guys.
3526
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.