 Hello, welcome to the video again, and this time we're going to implement the singly link list in Python. So this is the application we'll be building, and I'll be using Visual Studio Code as my IDE. You can use any idea of your choice, it doesn't really matter. So let's go over here to the desktop and show you, let me close this and I'm going to go right here and create a new project. Actually, I'm inside my C drive, I created for protocol code Python, and I'm going to create a new folder here, call it the linked list. Okay, open that in here, and it's a terminal here, and a URL just type in code, actually no CMD, I'm going to open the terminal, and then just type code dot with a space dot, and that will load Visual Studio Code. Okay, so I mean, this is just very basic stuff if you know to get there, and that's fine, but no matter what you do, just go to IDE, create a project or linked list or whatever you recall it, and we'll start from here. So I'm going to just set up my program to be a little bit structured, so I'm going to create a folder in here called, we'll call it list, okay, this folder will contain the list linked list, because later on maybe I want to build on this, I'm going to add like, you know, W linked list and other types of lists I want to put into a module, in this case it's called a folder, I also want to create another one for the node, this will contain the type of nodes, things like the W linked list node for single linked linked nodes or other types of nodes, okay, and then inside my list over here, I'll solve the node first, okay, and I'm going to create a under init, under .py, this is a file that Python will node that this folder called node is a module, that's what you do, you can leave it blank, it's fine, but usually you can import and export data from here, and so that you can access this file directly without going to the actual folder or file, so I'll show you in a minute, we'll come back here, so first let's create our node class in writing here in the node folder, so when she's going here and creating new file, and well I'm going to call it a little bit long, it's okay, singly underscore linked list underscore node .py, okay, so this will be our actual file name for this Python program, and inside here we are going to create a simple class called S node for a single linked node, because I intend to create another node later in the future video series called the W linked list, so I'm going to call it D node and so forth, so otherwise you can call it node, doesn't really matter, but I'll call it S node, and then here I'm going to have an initializer for the constructor that takes the self and the actual item to be instantiated when you create the first node, so we have the self.item, you initially want to set it to none, and we have another one here, the next node will also be pointing to not initially, okay, so that's the basic constructor, and again typically you want to have your get and setter, so I'll put here for get node, get item, and then this will be just return the self.item, oops I'm mistyped, here we go, and then we'll do one for the getter, I'm a setter, let's see set item, we need the item coming in, so we just put here self.item is equal to item, now you see that you know usually sometimes I guess it's up to you how you do it, some you know people like to put an underscore here for these fields like this because these are already known as private data fields, and so instead of accessing directly you want to go to the function to get them and set them, so that's another preference, but for my example I'll just use the item and next, just not to confuse you with the diagram already introduced, okay, so these are some functions that you can use, so when you initialize this and the constructor after that you want to call the set item to set it, and pass the item to that function, so the item comes in and the constructor could pass that to the function here to set it, so now item is now that item, okay, it's also nice to have another to override this function called the string function, this function here will print the you know the item to as a string base, because usually you can have all kinds of data types, so it could be an object, it could be an image or whatever it is, and so you know it's nice to kind of print it out to the console, you can see, so in this case I'm going to overwrite this function and return the string format of this self.item, okay, you can do self-item, you can call it the get item, it doesn't matter here, just use self-item for now, okay, yeah, so these are the functions and the feature you use in this node, of course I would just use the dot next right away, in this example again you can use the get and setter for this, like get next, set next things like that, but would you use the dot next in this case, and that item just to make it easy, okay, but again this will be just put it here, you don't have to use them, but again depends on who you work for, how you make a policy for your program, because Python is not really like this and not what do you call, what's the term, private, there you go, yeah, you can set private in the Python, not easily I see one in Python and other languages, okay, so that is the s node for that one and basically that's it, so now when we go to the program, the init over here, I'm going to import this node so that I can use it elsewhere, okay, and the reason why I do that is because I'll show you in a minute, so I'll go over here, create a new pro, let's create a main program in the outer space over here, let me make sure it's outside here, not inside the class or the folder, I'll call it my list.py, and this will be my main program, okay, so this main program here is going to import a list of the single linked list, not the node itself, but the list itself, so before we do this I should go back to the list over here and create another one, so let's go back here and we'll create just the initpy, okay, so again the same as before, so in the link list here we're going to create another file for now, I'll call it singly linked list, and this will be the actual file for that singly linked list, okay, so when you import the file, the node file, this node file here to this file, you can use it, right, so usually you would do something like from the node dot singly linked list, right, import the class call as node, okay, so I mean you can do that, that's completely fine, absolutely of course, and the reason why I had the init here is because inside the node you can do this, you can import it here, from the node dot singly linked list import the s node, okay, so you have s node here and import it inside the init file, so that in my singly linked list file instead of doing this way I could do this, from node import the s node, you can see much shorter and you can alias this as to a node only, right, so you can import all the different types of nodes in it and just import as node so that you can use in your program, okay, so it's much shorter, much better than going through all these dot dot dot and so forth, so that is the reason why I put that there, so this will be the base for the singly linked list and we'll create that in a minute, so now let's see we have our singly node class is already finished, we have our main program here, we'll be importing the singly linked list from there as well, so likewise, I'm going to go into the init here, just like before, from the list dot singly linked list, there's the name of the file, I'm going to import the class called singly linked list, which I didn't create yet but I will, singly linked, okay, and that will be the actual class name, so I'll do that here for, I'll say this and so let's go to our singly linked list over here and create the class, so this time we're going to create a very simple class, well I mean not that simple but what could a class called singly linked, okay, this will be the same as what I called over here in my init here, so this is the one I'm creating, I'm making sure I'm going to copy it and put it here, make sure it's the right name, okay, so there we go, and when we create this file we're going to have a constructor as well and that will take no data, we're just going to initialize the self.head, that'll be pointing to non-initially, we have one for self.tail, also pointing to non-initially, okay, so that is our constructor for the linked list and we will also be, if you want you can also create another one here, maybe we should call this size of the list, so initially it was set to zero, that would be the initial size and so you get functions like get size and you know and so forth, so a lot of the features we implement in future is like to get the size, append to the end of the list, to the front of the list, insert in between and so forth, okay, so we'll come back and we will do those in a separate video, but this is the default for now, so let's save this and now let's go and to the main program and so now that we have created our a node class, okay, we import it and then we can export it out later, we're going to use this node class inside a linked list class, so that we import the node from there, we use it as a node because eventually when we apparently create nodes, we use that in here and then we import it in here, so we can export the single linked list out, just like the node list here, so the main program, we're going to import that from the list, as you can see, import the single linked list, okay, and now we can use it in our program, so and this is the main program, so I'll put here a function called main and then we'll start from here and then down the bottom, make sure we invoke that main function and we are good to go, so and I'll stop here and then the next video, we're going to come back and we'll do a little implementation, how we can add data or append data to the list,