 Hey all, Mr. Gibson here, ready to show you how to log in and use the NCSSM Data Hub, which is a host for our Jupyter Notebook environment. So if you navigate to datahub.ncssm.edu, you'll land on this page here, and you're going to click the big orange button that says sign in with your NCSSM account. Now when you do that, it's going to prompt you to log in using an email address. Please use your school email address. I'm going to use our test account here. And when you log in, it's going to start up your server. Everybody gets kind of an individual server, and you'll see a couple of messages going across. If you're curious about what it's doing, you can look at the event log. But basically what it's doing is it's just starting up an individual environment that you can navigate that nobody else will have access to. And from here, you'll be presented on this screen. On the left-hand side, you've got a pane that shows you folder structure. So any files you find are going to be here. By default, everybody kind of gets this lost and found folder, which is something specific to running Unix. You can just ignore it. In fact, if you want, you can just delete it, and it won't hurt anything. So you can right-click on it. You'll see you'll get a nice context menu that gives you some choices here. I'm just going to click Delete, and that lost and found folder will go away. No problem. Going across the top, you have a button for a new launcher, which is the screen that's here by default. You can create a new folder. You can upload files from your own computer. And the launcher will allow you to create new files right here on the server. Most of the time, we're going to be using this choice right here, the Python 3 notebook choice. If you want to use this environment for other work that you might be doing, maybe your staff class uses R, you can absolutely use those choices. Not a problem. Let's go ahead and click on the Python 3 notebook to get a new one started. By default, it's going to create that notebook as untitled.ipynb. Every Python notebook file needs to end with .ipynb. It's what tells the software that this is a notebook file. Take all of the code that's kind of hidden behind the scenes and present it as a notebook with all of these nice cells and markdown and things that make it look nice. You can close the file directory if you want to focus in on just your notebook by clicking on the file browser icon, and that'll go away. I'm going to zoom in so you guys can see what I'm typing a little bit easier. A few things before we start running code. You'll notice along here on the bottom, it shows you that you are running a notebook with Python 3 as your kernel. The kernel is kind of the back end of the server that runs all of the code. So by default, when we click down that Python 3 button, it shows to connect to a Python 3 kernel so it can run our Python code. You'll also see how much memory that your current server is using. Everybody gets 500 megs of memory to use, and the more notebooks and more data you have stored into the memory, the larger this fraction will become. It'll actually allow you to go a little bit over 500. It tries to keep you right there. If you notice that starts to creep up or even you start to get an error message saying you're running out of memory. If you go to the left and you click on this kind of circle with the square in it that says running terminals and kernels, if you click on that, it'll give you a list of all of the notebook files that are currently running. Typically what happens is that students will have a couple of notebooks running, they'll close the tab, but those notebooks keep running in the background. So make sure that when you are done using a notebook for a while, close the tabs, come over here, and then click the big bright orange shutdown button, and it will actually shut it down in the background as well. That'll free up a lot of memory, allow things to keep running smoothly. Okay, once we get into the notebook, let's write some code here. So maybe you've already read through a couple sections on some operations that Python can do. What's great about Python is that you don't need to know a lot of special commands to make things work. You probably can make it run right out the box. So R to do two plus three, I could click run on this cell, and it's going to go ahead and execute that command, and it will always show you whatever the last instruction is. It'll always print that out to the screen for you. You don't even have to ask, you'll just do it. You can see that it's trying to kind of color code things. Python will color code different pieces of code. So it knew two and three were objects. It knew that the plus sign was an operator, and it colored them accordingly. The nice thing about Python in a notebook environment is that you can have these cells that run code, but then you can also, using the drop down menu, change your cell to a markdown cell. And a markdown cell will allow you to provide some context about what your code is all about. So I could write in my first notebook, the fact I put a hashtag symbol at the beginning of the line indicates this is going to be a header. And then I can say, this is my first Python notebook. And when I run this cell, you can see it's taken that formatting, the hashtag symbol is a special formatter, and it made that look a little bit different than when I typed it out. I can drag this back up to the top. And now I've got the start of a nice little notebook here where I can keep some notes in. I can run some code in. It is kind of a nice one-stop shop. We'll try a few other commands here. A few common commands that we'll be using a lot in this course is the print command. The print command can take in a calculation. So maybe I want to do four squared. And I can run that and it'll print it. Since it was the only calculation, I didn't need the print command. It would have shown it to me anyways. But it's nice to get used to the commands we'll be using a lot. Let's see. Some other common operations that we'll use are, of course, multiplication. We can do division. And I mentioned this in the online readings. When you're dealing with float numbers, or decimal numbers, I go out to a lot of decimal places. I thought actually we'll lose a little bit of accuracy just on the way that it stores them. It will not be uncommon to see this kind of random five here. And we know that this series of threes, when we divide them by three, should go on forever. That last decimal place will often get a little bit off. In terms of accuracy for your calculations, it's never really big enough number to worry about. But I don't want you to think that something's going wrong on your computer, or the operation that you did, if you see that 15th decimal place off by a little bit. Not to worry. Python also has the floor division operator. That's a double divide. We'll use that occasionally. And then another operator I'll mention here is the mod operator. So if you think about floor division, tells you how many times three could evenly go into the number 10 three times. One way to think about the mod operator, which is the percent symbol, is it tells you what the remainder is. So we know three divides in the 10 times, but there's a remainder of one. So that's one way. We'll talk a lot more about the mod operator in future lessons, but I wanted to just kind of get that symbol out on the table here today. If you read a little bit about data types in Python, we've worked so far working here with integers. 3.1 was a float. Another type of data that we'll work with are Boolean values. Boolean are basically just true and false. We don't store them as strings, but they have their own special object type in Python. And when you type the word true, you'll notice it lights up green, just like the word false does. And these types of things we'll see more often than not when we start comparing values. So if, for example, you were to do one divided, or sorry, one less than three, it'll come back as true. If you did three equals three, that'll come back as true. Or one not equal five, that'll come back as true. So these things are nice for us to be testing whether things are equal, greater or less, than all those kind of comparing things. And we'll learn more about that in future lessons as well. I just wanted you to be aware that there is this whole data type that's just devoted to displaying if things are true or false. At this point, you know how to log into the notebook. You know how to navigate around the menus. Feel free to play around. You're not going to break anything by choosing some of these menus. The only thing I will point out that will be a common occurrence that you might need to do if you're ever getting some weird error messages, is make sure that you restart your kernel and clear all the outputs. What that'll do is it'll take anything that's been stored in the memory, wipe it out, and it'll just leave you with the cells that have code that you ran previously. And now you can start from top to bottom, executing those cells again. And this is a nice way to make sure that there's not a random variable that's getting stuck in the works. It just will flow a lot nicer. One keyboard shortcut for you before we head off. If you want to run a bunch of cells quickly, an easy way to do that is to press the shift and then enter key in a code cell. It'll run that cell and move you to the next one. And then if you keep pressing shift enter, shift enter, shift enter, shift enter, it'll run all the cells in sequence and you can work your way quickly through your notebook. That's it for now. We'll catch you on the next one. Thanks for watching.