So friends, how did you get on now? I will say if this is the first time you're
using Python
This is quite a challenge
So definitely do not beat yourself up if you found this really quite confusing
So quite honestly even if you only got part of this challenge done
Then that is really quite good if you got all of the challenge done then
honestly I'm quite impressed
So let's walk through the solution the very first thing that I want you to do
is to create a list that is comprised of four elements
OSPF EIGRP, BGP and RIP so let's go and do that then
We go to this browser here. Let's open this up and what I will do is I will WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
We go to this browser here. Let's open this up and what I will do is I will
create my list now
I can call the list to anything ISO wish just choose a variable name so long as
we are following the conventions that we specified before
So in my case here
I will just choose to call this list routing protocols something nice and
descriptive once again
This is good practice now how do we actually create a list you remember?
We're going to use square brackets and each element within the list is going to
be separated by commas now each element
It also has to be a string so we're going to make sure each element has
quotation marks WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
quotation marks
So what was the first value? It was OSPF then EIGRP, BGP and RIP so also OSPF
comma then EIGRP comma
Then BGP comma and then finally RIP so if you manage this part then you were
successfully able to create the first part of the challenge
Now let's go to the next part
We want to include a for loop to iterate through each element and
Print it so I will use the for keyword now I can choose a variable name
anything I also choose but again
It does make sense to use one that is pretty descriptive so I don't want to say WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
It does make sense to use one that is pretty descriptive so I don't want to say
for pizza and routing protocols after all much more
sensible instead to choose the name protocol
So I will have my colon here and if I hit return we're going to indent within
and all I will simply do now is to print out the
Protocol variable that I'm looping through okay
So if I go down here and I choose to run this give a moment as we can see here
We are printing out each individual value here's OSPF EIGRP BGP and RIP the
last portion of the challenge WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
last portion of the challenge
And that's probably the hardest bits is to modify the logic to include a single
conditional check
We want to check that if the string BGP is within the list
We want to print at the statement that is an exterior gateway protocol
available
So let's try this then so scrolling on up as opposed to just printing this here
Let's modify this and we'll run the check we'll say if the protocol we're
looking through is equal to
And we'll say BGP then I'll have my colon and then indented within I'm simply
going to print out the statements
There is an exterior gateway protocol available WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
There is an exterior gateway protocol available
So now if I get down and I run this here and look at it right here
It says there is an exterior gateway protocol available
So friends that is us for our validation challenge
I hope it's been informative for you and I'd like to thank you for viewing