Hello, in this demo, we are going to look at modules within Python. So modules essentially allow you to, you know, organize your code. And instead of having all the code that perform the same functionality for, you know, different features in the one file allows you to import it. So we've already actually used this in the previous video, we saw it glanced over and saw just took it for granted. So one is don't use was import map and mapping the module name, import in just a command thing, you know, we want to import this particular module. And you can import as many as you want.
So within math, there's the functions there's no constants, one constant is math.pi. So if you print this out, for to add anything from the math might do it that we've imported, you just do math. dot whether it's a function or a variable, and I'm going to say accessing slash, including, think of this as really similar to what you're doing like a C or c++ language, where you would have a hash include very seamlessly if you come from that sort of background or feeling from PHP, something like require one. So include ones with quiet include is that sort of equivalent, so important included module. That's pretty cool. But this also has a lot content, you have a lot of overhead because I've included all of the math module, what you can do is just include a part of it, but if I wanted to just do import, let's see if I just literally wanted the pie pot strong.
The module name, so it would be math. And then I'll just say import will why actually want to import. So if I just say hi. And then for when this math is not defined I for this, this like so. There we go. Because we have an important the math module we just imported something specifically.
But using this line, we find access other functions or variables or anything else from the math module, what we've important is the PI constant. So I'm going to make a comment from from leaving that you can check that check it out in the source code. So this is actually a not functionality importer, for the specific name bar prefer that. And we'll go back to the import math, for example. So another thing we can essentially do is sort of see what is part of the maps module so you can see everything that's part of it, or any module for that example. And what we can do is basically do content equals oil.
So the DIR just essentially returns all of the strings, you know the names of the module names, but for the module name, so Matt, and now we just went contents what we got changing Back to import math and math.pi rerun this. And there we go. So these are all of the methods or you got the AC in your SIM card, so your trigonometric identities, the factorial flow, and there'll be pi right here. So these are all the features of the math module classes are actually really four modules in their core essence. And we're going to be going into this sort of abstraction in more depth over the next few tutorials, especially when we start looking at classes. Fast watching.
I look forward to seeing you in the next demo.