### Video Transcription

00:00

Hello, everyone. And welcome back to enter the python here on Cyber Eri on demand, I am your instructor, Joe Perry. And in this video, in this lesson, Lesson seven, we're gonna be talking all about python numbers. So numbers in Python, we've used a bunch of them. So far, we've done a bunch of logic with them, but I just want to take a few minutes here in this lesson and just kind of break

00:19

down all the different components of them

00:21

so that we can understand them a little bit more effectively. Before I jump to the VM, I'm jumping the gun a little bit. Our objectives in this video we're gonna learn about the different math operations and python gonna learn by the differences between its and floats and how to use each of those on. And that's really all we're gonna need to worry about for numbers in python.

00:37

So much of the hard work of numbers is abstracted away from us, so we don't have to worry about,

00:41

um they do have methods much like strings do. But for the sake of an introductory course, we're not really gonna be worried about those.

00:48

So their math operations and python or just like math operations in, well, math.

00:53

We could do things like four plus

00:56

two

00:58

five

00:59

five minus four.

01:00

One will do 10

01:03

times eight

01:07

and as a little example right here, 20 divided by

01:11

five. Now you'll notice this is different, and I have kind of alluded to it. In previous videos

01:15

that printed 4.0,

01:18

there is a difference in the difference that I mentioned right here in this objective between EMTs and floats and in python. All of these things are numbers, and python will use it and make it work just fine. But

01:29

it is worth noting that there is something under the hood being abstracted away from you that can be useful and can be important.

01:34

So when you're doing division, if you don't want to get back in decimal place, you'll do what's called floor division,

01:41

which is going to just divide and just give you sort of the round number of that division. So remember, from our use of Modelo in a previous video that we did 20 module 05 who will give us the remainder, which, in this case, of course, 0 21 module 05 would be one.

01:57

So if we did 21 module 05 and 21 floor divided by five.

02:01

We'll see that four, even though 21 isn't evenly divisible by 54 is the dividend, and one is the remainder. And I think I'm using that word right. I think its dividend it might be divisor. I haven't actually had to use the names for arithmetic in, like 20 years or so,

02:17

but so that's the basic way of using instant floats. That's the difference between them. The primary thing to understand about floats is that floats have decimal places. Floats can address non whole integers integers our whole numbers. They could be negative or positive. They're just never going to be sort of, you know, fractional number.

02:35

Where's floats can address fractional numbers.

02:38

So I showed you. We have plus minus times. Divide. We also have exponentially ation available to us

02:45

four to the power of four is gonna be 256.

02:47

Then we have one more subject in numbers. Numbers is a much easier lesson than strings.

02:52

One more subject of numbers. It's really, really cool to address.

02:54

There's a special number in Python.

02:58

It's not really a number. So just a placeholder for a number.

03:01

And that's the underscored.

03:02

And you can see here that now underscore equals 256 because it is the result of the last operation, the last mathematical operations.

03:10

So if we did five plus three

03:14

and pretty underscore,

03:15

it'll be eight and underscores just a useful way to track math we can do. I'll show you in just a 2nd 1 of the other really cool things we could do with it. But I do want to point out never, ever do that. Never assign a value explicitly to underscore is what will actually happen there is. You'll create a new variable

03:31

and you're gonna blow away. The built in sort of magical underscored would never, ever do that.

03:36

But one of the other things you could do with underscore with the sort of pseudo number that is underscored is you can use it in loops for underscore in range

03:45

10

03:46

prints.

03:47

Hello,

03:52

and what's cool about this is what it's really doing is it's just saying for each number in this range, without ever actually storing that number anywhere, it's just sort of a useful shorthand in Python, where you're just trying to use that range for just a count. The number of times you're doing something and the number itself isn't relevant

04:09

is actually all there really is to math operations in Python. You do them the same way you would do in algebra if you have to use an order of operations that works exactly the same way it does in math.

04:17

And then we talked about the differences between imagers and floats. The idea that floats can use fractional numbers.

04:24

That's all there is to lessen. Seven. It's sort of a palate cleanser between strings and the much more interesting or, well, much more interesting and somewhat more challenging lists and dictionaries there coming up. Speaking of which, I hope to see you back in our next lesson. Lesson eight. We're going to do a deep dive on lists and, of course, all of the material for lessons five through nine.

04:42

We have a lab four provided by the spectacular company. Next check.

04:45

I know that I keep talking about them. I actually should probably address that they are a partner of Cyber Eri, but they're not actually sponsoring this video in any way

04:51

They're not. You know, I'm not being paid to talk about them or anything like that. We just use their lab. And absolutely, I just love it so very much. And I want all of you to use it as well.

05:01

Eso please, by all means. Take sometime, do those exercises and really just dig into the code. I'll see you back for less than eight. Thank you. As always for watching I'm your instructor, Joe Perry. And you've been watching intruder python here 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

Joe Perry

Instructor