All right.
So let's write our very first piece of code related to cybersecurity and this one
will check to see if a user and a password is actually valid or not.
You're more than welcome to try writing the code on your own. If not,
let me show you how you will do this.
So the first thing we need to do is we need to indicate
what the password is. So
I'm going to call
the variable in here is stored
underscore password.
Ok. And let's provide a value for the password.
I'm gonna go with something very, very, very, very generic.
Uh let's say password,
uh 123. Ok. So this is going to be the actual password.
By the way, I'm not sure if I've mentioned this before. But
in Python,
if you wanted to add like a comment or a hint
in your code, you can do so by using the hashtag symbol and then type in your comment.
Ok. So
maybe I've mentioned this before. If not. Well, there you go.
Ok, so
start password. Here it is going to be password 123. So now
we need to ask the user
to provide the password.
And then once they provide the password,
we can then run an el statement that will check to see
if the password they've typed in is actually correct or not.
If it's correct, we can say access granted. If not, we'll say access denied. So
the first thing I'm gonna do right now is I'm going to get
the user input. So let me just add my comment and say, get user input as the first step.
So
what we'll do right now is we can call
the user input, we can call it the NT
password.
OK.
This will be the variable that will store the input. So
right there, I like the suggestion that Python has given us. So
it simply says enter the password equals imputes and then
we're going to ask the user to provide their password.
So the next image to do right now
is to see
if whether or not
the passwords actually match. OK? We wanna make sure
that whatever they type in here is going to match
the password that we have stored. And by the way,
it's kind of amazing how I don't know if you,
if you see the exact same thing on your own screen.
But Python is literally just writing the entire code for me and I promise you,
this is the very first time
I'm actually writing this code on
replete. I promise you, I haven't written this code before.
It's amazing how it's so smart, it's so intelligent. It knows exactly
what I want to type and that's exactly what I want to do.
I wanna say. Ok, if
the end of the password
is equal to the start password, what are we gonna do?
We are going to print.
Ok. And then in brackets,
string access
granted.
Right.
Oh,
sorry about that.
What are we gonna print?
We are going to print
brackets codes,
access denied
and nowadays
and maybe remove the extra code right there.
And there you go.
That is our code right there.
Very simple, very straightforward. Let us try it. So I'm going to run
and now I'm going to ask for the password. Let's try.
Uh James 123 did not work. No access denied.
Uh
Well, it did not work. Let's run the program once one more time.
Let's not try password
uh
passwor
123
press enter
and there you go. Yay access has been granted. So
our code actually works properly. And
of course, this is just a very simple block of code.
It's not the entire program itself,
but this is the very first step towards
creating a more comprehensive uh password checker tool.
Thank you for watching the video. I will see you in the next class.