Time
2 hours 57 minutes
Difficulty
Beginner
CEU/CPE
3

Video Transcription

00:00
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.
00:20
We learned about the different generic variable types. Now, this is a very broad
00:24
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,
00:43
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.
01:03
In reality, variables and programming work exactly the same way as they do in math.
01:07
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.
01:25
You're variables just exist to represent unknown information.
01:27
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.
01:47
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,
01:59
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
02:20
drive convertibles.
02:22
You're gonna let that sink in for a second,
02:23
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
02:42
we're gonna discuss pythons in a few lessons.
02:45
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.
02:57
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,
03:15
when you're doing when you're writing a program, you're gonna deal with real numbers most of the time.
03:20
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
03:34
relatively easy to represent with with programming variables,
03:38
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
03:54
that said, strings are their own type of variables because they do operate differently from numbers,
04:00
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.
04:09
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
04:19
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,
04:38
their structures, as you can see over the side. I have a blueprint,
04:40
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.
04:53
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.
05:10
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,
05:27
one of the main gotchas. If you look down to the third item here, where X equals object one,
05:30
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.
05:49
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
05:54
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.
06:11
And then we broadly talked about what types of variables exist. Number strings in structures.
06:15
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
06:34
on cyber eri on demand

Up Next

Intro to Python

This is an introductory course on Python for cyber security, giving students the ability to understand the basics of the language, solve problems with scripts and identify useful Python modules.

Instructed By

Instructor Profile Image
Joe Perry
Senior Technical Instructor at FireEye, Inc
Instructor