1.3 Variables - IP

Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *

Already have an account? Sign In »

2 hours 57 minutes
Video Transcription
Hello, everyone. And welcome back to intrude a python here on Cyberia on demand. I, as always in your instructor, Joe Perry. And as always, I'm very excited to be here today to talk to you about programming basics. Today we're gonna be focusing on variables because we are in lesson too. So the objectives in this lesson we're gonna talk about the concept of variables, what they are, what they're for, what they do.
We learned about the different generic variable types. Now, this is a very broad
description of the variable types. There are a lot of you know, there are a lot of subtypes of these are a lot of people who will disagree about sort of what a generic variable even means. But for the course of this video, because I'm the one making the recording, I get to decide what is and is not going to be covered. And I'm going to say there are numbers. There are strings and there are structures,
variables. What are they? What are they for? What do they do? The best way to describe variables is Tupperware for your brain. Variables could be really tricky for new people to learn they. A lot of people get very wrapped around the axle with the concept of them, and the truth is that they're not nearly as complicated as they seem. They're not nearly as complicated as you may unintentionally make them see.
In reality, variables and programming work exactly the same way as they do in math.
In Matthew have a variable that represents an unknown value. Right X. When you're searching for ex, all you're trying to do is figure out what that unknown value is. But the point stands that it's there to represent that value, whatever it may be. In programming, it's exactly the same. Your variables exist. Oftentimes we use X as a variable.
You're variables just exist to represent unknown information.
Sometimes that information is going to be put by the user. Sometimes it's derived from some other operation. The key thing to understand is that the variable in these equations here we have two plus X and four plus X. The variable is just a stand in for information that we have not yet determined Tupperware for your brain.
So what's in a name? This is a slightly tongue in cheek reference. Have you not seen the image right above me. That is, from the 1996 Romeo and Juliet adaptation. Um,
wow, he's in a bad movie. It's one of the most unintentionally funny movies of all time. That's not relevant to programming. I just I like to remind people that it exists and that it does involve Romeo and Juliet set in Malibu, but with the exact same language. They still say they still speak in Shakespearean English, but also they
drive convertibles.
You're gonna let that sink in for a second,
all right? And moving on back to programming, we're gonna, depending on the language in the paradigm. Like I said, there, a lot of different kinds of variables and different people will disagree about what constitutes each type of variable on whether or not different whether or not you could even have a generic variable. What's important understand here? Is that all? We're really trying to describe our sort of bins for the types of variables
we're gonna discuss pythons in a few lessons.
We're very spend. We're gonna spend very long times in each of the module to lessons deep diving the different types of python variable, But For now, we're just gonna use the broad terms of number, string and structure.
So numbers a number is a single number in the real number set, complex numbers can be represented and programming generals beating their special modules and libraries do that for you or to help you do it. Generally speaking, you're gonna be working in real numbers and programming unless you're doing some very specific. Unless you're working in physics or in mathematics or whatever,
when you're doing when you're writing a program, you're gonna deal with real numbers most of the time.
012345 onward and onward to infinity ad infinitum. 0.1 point 1.1 point there, there, there, we want etcetera, things like pie or E or the natural log. All of those are real numbers. All of those
relatively easy to represent with with programming variables,
strings, which are actually sort of a derivation of numbers. Right In programming we've talked about in our last video, all of computer science is derived from zero and one. Therefore, strings really are just representations to the to the screen, to the user, to the program of zeros and ones
that said, strings are their own type of variables because they do operate differently from numbers,
they generally exist to hold one arm or printable characters. It's possible to use non credible characters and strings. You'll see that used a lot in pen testing in an exploit development.
But generally speaking of string will hold one or more probable characters. Here we see uppercase, a lower case, a punctuation, weird marks or sentences. Entire arrays of character
finally structures. Now structures is a very, very, very, very, very, very broad description. All it really means is some sort of abstract data type derived from numbers and strings. Really, what that means is derived from numbers, so structures could be used to represent all sorts of things. There are structures out there that will represent entire Web servers,
their structures, as you can see over the side. I have a blueprint,
their structures that are blueprints for code or blueprints for buildings. A structure, again is just sort of an abstract data type that represents something that's more complex, that needs more operational capability than just numbers.
So knowledge check and I left these on the screen because I really want to just dig dig into it rather than kind of doing a quiz. Which data type is X in each of the following statements? X equals test is a strength because and this is very important. This is one of the reasons why I didn't make this a quiz, instead made it a check.
Strings are almost always going to be enclosed in quotes in Python, which the class you're taking strings were always enclosed in quotes. It might be a single quote that might be a double quote. They might be a set of three double quotes and single quotes on either side. We'll talk about what? That's four in a while, but they will be enclosed in quotes. That's how you know it's a string,
one of the main gotchas. If you look down to the third item here, where X equals object one,
that's a structure because there aren't quotes. Python will interpret that as a variable, not as a strength. So what? A lot of times when you're writing Python code, people will forget their quotes and their program will break and they won't understand why. And they come to me. Joe, I don't know what's happening. What's wrong with my code? Can you fix it? And I put in a pair of quotes and then they have to walk away. Shame based.
So that's one of the first things you wanna check it we're gonna talk about Gotsch is as we go through this course, there are a lot of sort of
specific problems that crop up over and over again and programming. And that's one of the big ones. And of course, X equals 1.2. In that case, X is a variable, a number variable. So summary. What do we cover in this video? Well, what are variables? The answer. That question is Tupperware for your brain.
And then we broadly talked about what types of variables exist. Number strings in structures.
So that's really all there is for this video. I hope to see you back in our next one's gonna be programming basics if statement, we're gonna start in on flow control, and that may not seem exciting, but it really, really is because that's one of the first steps you have to take to writing true functional riel programs. I hope to see you back. As always. I've been your instructor, Joe Perry, and you are watching this
on cyber eri on demand
Up Next