 How's it going everybody? My name is John Hammond and welcome back to a YouTube video tutorial. Alright, so I want to be jumping back into a little bit of Python. I'm trying to recreate some of the old tutorials I had made years ago that honestly were not that good. So I'm trying to re-teach the beginnings or the basics of Python. So hopefully we'll just be able to crank through the basics and get to some really cool stuff. So I'm trying to teach this as a ground-up perspective, so we're going to start from scratch. I'm going to use Sublime Text 2 as my text editor and I'm going to go ahead and create a new file. We'll call this...actually I'll just create a directory for it, make directory Python tutorials. So now in my home directory I'll just save this as first.py. Because a Python script or Python code should always have a .py extension. And now we're ready to run Python code. So Python is real simple. If we wanted to make our own Hello World program, real real simple, just a beginner basic programmer lesson, we can just print. That's all the statement that we have to do and then we'll give it a string, which is a set of characters or text and we can print out Hello World. And that's it. That's all we have to write. So back in our terminal we can actually get into that directory. We have that first.py file that we have and we can pass that into Python as our interpreter. That file, Python first.py, and it'll print out Hello World just like we told it to after we save the file. Sweet! That's awesome. Really simple program. But you notice I'm calling that with Python. I don't actually do like a regular program invocation, like I'm not using a .slash first.py. I want to do that. I want to be able to do that. First we have to make that file executable. I can do that in Linux with chmod first.py plus x to make it executable. Now it's got that green highlighting. And we can run first.py, but it's going to freak out. It's not running Python code. Right now it's running something else. We have to specify in our code that, hey, we actually want Linux, we actually want our operating system to determine that this is Python code we want to run. So we do that with a shebang line. I'll actually explain what that is. Or shebang line. Shebang line. Shebang line is nothing but an absolute path to the bash interpreter or any other interpreter that we want to use and specify when we're working in Unix. So we can use normally if we're running like a bash or an sh script, we can use bin sh, which is the syntax of a pound symbol or hashtag exclamation point and then the path to our executable. So if we wanted to use Python, we could use forward slash usr bin space environment Python. So that way, whatever Python interpreter we use, it's set up specifically environment, it'll be able to figure it out, hey, environment, whatever our Python interpreter actually is. So now in our terminal, because this is marked executable, we can run dot slash first dot pi and we've got Hello World. It's finally executing our Python code for us. So that's super duper simple. All we have is a simple program. We've figured out two ways to invocate it or start the actual program. We can just pass in as an argument to Python, or if we set up a shebang line and mark the script as executable, we can execute it with a dot slash like any of the regular program. Some more stuff I want to cover. Comments are started that same way with the beginning hashtag or pound symbol. Comments in Python can start with a pound symbol. They are not code. They will not be executed. So this way, you can kind of leave yourself notes and document the code that you're writing with. But they only work line by line if you use that syntax with the pound symbol. If I wrote any other comment on a line without that, it doesn't work. Anything that follows that pound symbol is considered to be a comment, but any other line without it or in the front is still considered code. But you have to have that symbol to represent, hey, this is a comment. Since that's just a single line comment, though, we can also have multi-line comments, which are really just elongated strings. And you represent those with the mark for a string, either a single quote or a double quote, have a set of three of them. Anything in between those two will be a comment. Obviously, anything outside will not work. It has to be wrapped inside those comment markers there. You can see the syntax highlighting kind of denotes that as well. Real simple stuff, but with that in mind, we can actually kind of make notes of our Python code and be able to have more information in the actual Python source code. So I'll be using comments a lot hopefully while I'm trying to teach you guys. Another way we can kind of invoke this is through Sublime Text, because it's an awesome text editor. We can actually build this Python script and run it within Sublime Text. Control B, if you hit Control and B on your keyboard, you should be able to see the output at least of this function. And we'll be able to do that. We'll just be able to look at the output of our code within Sublime Text. We can't interact with it all that well. We're not going to be able to read in input when we get to that point, but we can see output. So simple stuff, print statement. It's actually a function. You can wrap it with parentheses to represent, hey, this is a function, but it's also a statement in Python 2. There is a difference between Python 2 and Python 3. That's a whole other can of worms. But print statement or print function, whatever you want to consider it to be, string, simple stuff, hello world, and the syntax for comments. And the next tutorial, real simple again. We're just going to be looking at data types and cranking out all the basic stuff because you guys know how to do most of this already. I'm sure in other programming languages, I just want to show you how to do it in a good, simple way. All right, see you in the next tutorial.