1.7 Turning Logic into Pseudocode Part 1 - IP
Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *
or
Already have an account? Sign In »

Video Transcription
00:00
Hello, everyone. And welcome back to enter the python here on Cyber Eri On demand. As always, I'm your instructor, Joe Perry. And today we're starting lesson six python basics. Now, for those of you just jumping in, it may seem strange that lesson six is the python basics.
00:14
But I want to thank everyone who's watched with us from less than zero all the way up to now because you have been through a lot of power point and I have great news about that. There's not gonna be a whole lot more
00:24
from here on out. We're gonna only use our PowerPoint slides for the objectives and to do or some reason reviews.
00:29
The reason for that is because from now on, we're gonna be working right here in this bad boy, which is our a bunch of'em.
00:34
We're going to all of our Cody exercises practically. We're gonna talk about how we work in programming. We're gonna talk about Python. We're gonna do it in the V m with actual python code.
00:45
We do. Still, however, I don't want anyone to freak out. If you like to read your material, if that's how you learn, that's totally fine. We're gonna have some supplemental materials for all of you Are gonna have some cheat sheets you confined. We have documentation listed. I'm also going to show you where you can find the python documentation and their own on the python manual tutorial.
01:02
All sorts of information you can find if you're the kind of person like me who likes to learn by reading gonna have all that available to use. Don't panic
01:10
here in Listen. Six
01:12
in our V m, we're gonna have four main objectives were gonna split it up into three videos. This first video.
01:18
We're gonna discuss the python syntax a little bit, and we're gonna learn to use python on the command lot
01:22
in the next video we're actually gonna create. And we're gonna execute our first ever Python program. And then in the final video, we're gonna discuss the python help and dirt functions and help Under or two Really, really useful functions are built into python.
01:34
They will touch on some advanced form or advanced material we haven't covered yet. That's totally fine. We're not gonna worry about it too terribly much.
01:42
I'm just gonna make you aware that that's the case. and we're gonna use those and we'll show you how to make you
01:47
so learning to use python on the command line and learning about python syntax. What we're gonna do is we're gonna go over to our shell, which again all I have right here is Terminator, which is a quality of life upgrade downloaded that I downloaded onto the SVM so that I could use it for the show.
02:01
Nothing too terribly fancy or special happening that were here.
02:05
Scuse me through the water.
02:07
So in our terminal, what we're gonna do is we're gonna just run the python command.
02:12
Well, this is gonna do is it's gonna open the python interpreter. However, I want to caution you if you just run Python depending on your implementation, you may get dropped into a python to interpreter.
02:22
Which, of course, we've talked about Python too. Needs to be done dying by now. Therefore were only ever going to use python three.
02:30
Now, when you use python a lot of times have you run a Python three program in Python two's interpreter. It'll actually work or at least worked for a while because Python three was designed to be backward compatible.
02:40
However, there are python, three libraries and python, three modules that do not work in the python to interpreter because they don't exist for Python too.
02:47
Therefore, it's important to make sure that you're working in the right interpreter.
02:51
So to get to that interpreter, all we're gonna news. First, we're gonna clear our screen. If I can learn to type correctly there, Rio
02:55
Clearer screen and we're gonna take Python
03:00
three and the number is right next to the word python. There's no space between them that's gonna drop us into the shell. We want
03:06
now,
03:07
as I mentioned, a couple of as I've already mentioned in this video and I mentioned a few other times I compulsively clear my screen. I like to have a clean workspace. And to do that in the Python interpreter
03:15
is control out. Very useful. Command something. No, no.
03:21
So we've got our python inter. We've got our Python interpreter open now, and we're ready to start working to do that. I want to talk just a little bit about python syntax. And this is something that will continue to evolve as we discuss it in our if statements and four videos and things like that. They're coming in module two,
03:37
where we actually take all of the logic. We spent module one learning and we apply it to Python.
03:40
That said, we don't really have time to go over all of that in this video, So I'm going to use an if statement. I'm just gonna trust you not to worry about it too much until it's time to learn how if statements work in Python
03:51
that said, it's a useful way to show you syntax. So here we're gonna say, if X equals equals one. Well, first I'm gonna define X. So the pipes under the yell at me
04:00
if X equals equals one
04:02
tab
04:03
Prince,
04:06
get more
04:09
Now I said Tab and I hit the tab key. And that's actually so, surprisingly enough, Ah, point of contention for a lot of python programmers. Python in syntax is delineated is delineated by a white space. That is to say,
04:23
if I had not entered into entered that tab space here,
04:26
if I ran it like this, it wouldn't work. And we can see that by attempting to enter that in our interpreter and is going to tell us it expected an indented block.
04:34
So indentation and python is how you differentiate what code belongs to what other, what statements or what functions, or what logical and operations or what have you
04:45
when you write an if statement, whatever is going to be executed as a result of that conditional is going to be tabbed in
04:50
because it's it's a sub. It's subordinate code to the If ST
04:56
Now, the reason I said that tabs are contentious to a lot of python developers is that python is white space delineated, but white space can be achieved with either tabs or spaces.
05:06
There are people who will avidly argue for tabs there, people who avidly argue for spaces. And I'm going to make both of those groups upset now and tell you it actually doesn't matter that much. So long as and this is the most important thing.
05:19
You're consistent within your own code and with with the paradigm of whatever organization or project you're working on.
05:26
I personally believe in using spaces. I like them more, and I think they tend to be more consistent. Tabs are
05:33
time with convey Ari from system to system, and from I D. Ito, I'd be eat,
05:38
but everyone's gonna have their style. There are a lot of people who will actually go to their tab. Who will implement in their I D that when they hit the tab key, it will instead insert four spaces. When I'm working in the interpreter, I tend just to use tabs just because it's a little bit easier. In my ideas, I often will implement the force faces to attack rule.
05:56
Either way, Like I said, the thing that matters is that it is consistent because if you do something like this
06:04
tab for the first line prince
06:06
test
06:09
and then for the second line
06:11
use spaces,
06:15
that's actually going to break.
06:16
The reason for that is because Python is interpreting the tabs and the spaces as different kinds of white space. So if you were inconsistent, your program will break
06:25
either way for now. For this video used tabs, you spaces, whatever works for you. I'm just gonna hit my tab key and keep rolling through.
06:31
So the actual if we set out to write so long ago, if X equals equals one
06:36
prince
06:39
worked
06:42
and you can see that nothing printed the reason for that of course is because of the conditional evaluating false. And we'll talk all about how to use if statements and python down the road in a different lesson.
06:51
For now, we now understand one how to start the python show to how to run code in the python show. And, of course, three what python white space is supposed to be used for. The last thing we're gonna do in this video is a tradition among programmers were gonna write the phrase we're going to give Python the instruction in print.
07:10
Hello,
07:11
world.
07:13
Now, this is something you can do along with me Or do right after you watch this video. Hello. World is a traditional way to begin as a programmer. It's just it's the first program that a lot of people wrote. And actually in our next lesson, what we're gonna do is we take this line of code and we're gonna put it into a document and make it into a python script.
07:28
So with that,
07:30
I'm your instructor, Joe Perry. You've been watching intruder Python here on Sai Berry on demand, and I look forward to having you in our next lesson
Up Next
Similar Content