 # 8.3 Creating an Athletic Competition Starting List Part 3

Video Activity
Join over 3 million cybersecurity professionals advancing their career
or Time
8 hours 33 minutes
Difficulty
Intermediate
CEU/CPE
9
Video Transcription
00:00
So now that we have the function to determine the status off, none qualified.
00:06
Ah, the athlete that hasn't qualified by position.
00:11
We're going to put simple if here. So it's going to be if
00:15
and then
00:16
if
00:17
G three is
00:20
smaller than three. So it's if one or two,
00:23
then we're going to have here. Q.
00:28
And if it's not,
00:30
then we're going to call function, come
00:34
status and you see it's here. And their argument for that function is going to be just the time. So we're looking at this time has qualified or not,
00:44
and to close this close this
00:46
and you see Ah, we have a typing error. So we're going to close this.
00:53
It never happens that
00:57
you have typed everything
01:00
wrong.
01:02
So we're missing one t here. So link and cute time
01:07
and everything else seems to be in order. So we haven't to save this
01:11
and then to close this
01:14
and let's try this again.
01:18
Yeah, we have one. Why as well. So we cannot correct in the bunker mode,
01:23
so we have to go again.
01:26
And I'm really glad that this happened, because
01:30
now you see how it is important to take care when you're doing these things and how to be extremely, extremely focused.
01:41
So let's do it again.
01:44
Okay, so this one is not qualified. And let's move it here.
01:49
And ah,
01:51
we have a small mistake.
01:53
Let's see why.
01:55
Let's see how we can debug it.
01:57
So what is obvious that I made the mistake that I have actually sorted the disarray
02:05
in ascending order because you see how many of these air qualified and they shouldn't have been. So let's go here,
02:13
let's go to module one
02:15
and let's put here three.
02:17
And now it should be Okay,
02:22
so let's close this.
02:24
It's closed this
02:27
No, let's, uh,
02:29
do this since, well, still not qualified.
02:32
And now it's okay that we have 12345678 qualifiers. Which is exactly what we were looking for. So we have now, uh, qualified
02:47
eight competitors to the finals.
02:52
And now we have to determine,
02:54
uh, which off these eighth? Ah,
02:58
go to which lane
03:00
and uh,
03:01
to put their names in there.
03:05
So we're going to use names,
03:07
and, uh,
03:14
we're goingto make another function for it
03:17
because in theory,
03:21
we could use look up to do this,
03:24
but what we want and this is a rule in athletics. If you didn't know that the one with the best time out of those qualified
03:32
is going to be in lane four.
03:36
Then the second in lane five, then six, then seventh and eighth. Not sorry.
03:43
And so on and so on. Yeah, my mistaken in counting. 1234567 and eight.
03:52
So this is how it works. So only the 8th 1 is going to be in the lane that
03:57
is equal to his position. Or so, um
04:01
ah. So we have again to create another function
04:06
that will help us.
04:08
Ah,
04:10
put the name
04:12
in the
04:13
ah,
04:15
this column
04:16
off the competitors
04:18
that we'll have in. And then then we as a perimeter of this function we're going to put
04:25
here
04:26
864
04:28
Sorry. 7531
04:31
246 and eight.
04:34
So this is how it's going to work
04:36
and let's make this function.
04:40
So let's again to go to visual basic
04:43
plant, insert another module
04:46
and, uh, let's call it
04:51
function.
04:56
And I was going
04:59
fine. No
05:05
position of final name
05:10
and which will have one perimeter which is
05:15
again result,
05:19
and it's going to be because we're going to return the name. It's going to be string
05:27
and let's no
05:30
rights dysfunction.
05:31
So this function has to do pretty much
05:35
the same thing, like the previous one on Lee with a slightly different
05:41
parts of the end.
05:44
So we're going to again
05:46
dimension when Harry.
05:48
So let's call it
05:49
temporary,
05:51
and it's going to be 1 to 8 because we have only eight competitors
05:57
that we're looking at,
05:59
and it's going to be as
06:01
single
06:02
because we're going to have times there,
06:06
and then we're going to have to counters so dim I as integer
06:15
on Dhe. Then I won a CZ into Jer,
06:19
and we're going to have
06:24
some temporary
06:28
result as well.
06:30
All right, we need to temp it to dim. It's
06:33
Tim
06:35
temper result, and it's going to be as
06:40
single.
06:42
So we're going to do pretty much the same thing like we did in the first, so we're going to first pick. So let's copy some code.
06:50
So is good, because if you know that cold works, why shouldn't reuse it?
06:56
So let's, uh,
06:58
close this one,
06:59
and so I want is equal zero for 3 to 26.
07:04
And now we're going to look at
07:09
this
07:10
row. That's very calm, H.
07:14
And we're going to say OK, h and I
07:19
equals
07:20
Q. So if it's qualified, then
07:25
we had this time and then we're going to call this one. Okay, so it's
07:29
tar
07:30
off, And then again, we're going to look at
07:36
results. So f
07:40
and I and then def and next I
07:43
So we did this. And now we're going to sort this ray from 1 to 8 and hear from 1 to 7.
07:51
So it's just not going to be cold and your time, but our
07:57
and here a swell
08:01
and
08:03
then pres ult is the same.
08:07
Wondering why I didn't use in cute times. Well, there is no reason for that. I just wanted to make things a little bit more complicated.
08:26
And yeah,
08:28
here is a typo. So it would be an error in execution. It's okay. So now we have
08:35
very nicely sorted array off eight,
08:41
and, uh,
08:45
this is it.
08:52
Now we have to determine
08:54
if, uh
08:56
the result we have given to this function
09:01
is, uh, in which.
09:05
So what is the name off the competitors
09:09
that has that result.
09:11
So we're going to do that in another,
09:13
uh, Loop, but it's going to happen in a next video,
09:20
so
Up Next