1 00:00:00,000 --> 00:00:02,130 There's another way to run your Python code. 2 00:00:02,140 --> 00:00:04,230 You don't have to do it through your command line, although 3 00:00:04,230 --> 00:00:07,100 I like the command line just because I've been exposed to it for so long. 4 00:00:07,150 --> 00:00:10,470 But if you're brand new, the command line can be very overwhelming. 5 00:00:10,480 --> 00:00:13,710 Another way is to use this thing called a Jupyter Notebook. 6 00:00:13,710 --> 00:00:19,500 'jupyter.org', I believe, is the website, J-U-P-Y-T-E-R. 7 00:00:19,520 --> 00:00:23,570 And if we just click on 'Install', there are a few different 8 00:00:23,580 --> 00:00:25,190 ways to install Jupyter Notebook. 9 00:00:25,300 --> 00:00:28,510 So if you're already familiar with some Python, you have 10 00:00:28,520 --> 00:00:30,730 a little bit of background with Python, you can just simply do 11 00:00:30,740 --> 00:00:34,640 'pip install jupyterlab' or 'pip install notebook'. 12 00:00:34,640 --> 00:00:38,300 Now, chances are you probably don't have that kind of experience 13 00:00:38,300 --> 00:00:39,500 right now, and that's okay. 14 00:00:39,500 --> 00:00:42,590 If you don't, you can go to 'anaconda', 15 00:00:42,620 --> 00:00:44,540 I don't actually remember what this website is. 16 00:00:44,700 --> 00:00:47,200 I think it's 'anaconda.com'. 17 00:00:47,230 --> 00:00:48,760 Yes, 'anaconda.com'. 18 00:00:49,040 --> 00:00:53,240 So Anaconda is a Python distribution. 19 00:00:53,250 --> 00:00:55,610 It also comes with a lot of different tools. 20 00:00:55,620 --> 00:00:59,460 So if we click on 'Download', you can download for Windows, 21 00:00:59,470 --> 00:01:00,570 Mac, and Linux. 22 00:01:00,580 --> 00:01:02,760 It will install Python for you. 23 00:01:02,770 --> 00:01:05,700 It will also install a bunch of other things for you as well, 24 00:01:05,709 --> 00:01:07,290 including a Jupyter Notebook. 25 00:01:07,300 --> 00:01:12,390 So just scroll on down, click Python 3.7, or if 3.8 or 3.9 26 00:01:12,400 --> 00:01:16,100 is out, go ahead, click that, download it, and install it. 27 00:01:16,700 --> 00:01:19,000 Okay. So I'm just booting up Anaconda here. 28 00:01:19,200 --> 00:01:22,650 And you're going to see once this loads, it comes with a 29 00:01:22,650 --> 00:01:26,600 bunch of stuff. It comes with things like VS Code, RStudio, 30 00:01:26,680 --> 00:01:28,390 and Jupyter Notebook. 31 00:01:28,400 --> 00:01:29,290 This is the one we want. 32 00:01:29,300 --> 00:01:33,430 So I'm just going to click 'Launch' here, and that spun up my Terminal, 33 00:01:33,440 --> 00:01:36,910 and it's going to run the command line command from Terminal. 34 00:01:36,920 --> 00:01:39,250 And here we have Jupyter Notebook. 35 00:01:39,260 --> 00:01:42,580 This is probably going to be pretty hard to see on a smaller 36 00:01:42,590 --> 00:01:43,930 video. So let me zoom in here. 37 00:01:44,170 --> 00:01:47,590 A Jupyter Notebook is basically an interactive way to 38 00:01:47,620 --> 00:01:50,080 go through your different files, and create these things called 39 00:01:50,080 --> 00:01:51,900 interactive Python Notebooks. 40 00:01:51,900 --> 00:01:56,900 Now I have a folder in here called 'Python_for_Everybody', 41 00:01:56,900 --> 00:01:59,400 and this is where I'm going to be keeping all of my code. 42 00:01:59,900 --> 00:02:02,400 Now to create a new file, all you have to do is click this 43 00:02:02,400 --> 00:02:03,800 'New', go to 'Python 3'. 44 00:02:03,840 --> 00:02:04,940 I have Django installed 45 00:02:04,950 --> 00:02:06,170 so it's going to say this. 46 00:02:06,180 --> 00:02:08,860 It might not say that for you. 'Python3', 47 00:02:09,120 --> 00:02:12,070 and we're going to see this cool little thing. 48 00:02:12,240 --> 00:02:15,240 Now, this doesn't look like much to begin with. 49 00:02:15,250 --> 00:02:19,030 However, if we run that 'print' statement we saw in the last 50 00:02:19,040 --> 00:02:23,180 video, "Hello World", and we hit 'Shift + 51 00:02:23,190 --> 00:02:25,750 Enter', we can see "Hello World". 52 00:02:26,160 --> 00:02:30,220 Now, let's just walk through Jupyter Notebook a little bit, 53 00:02:30,230 --> 00:02:32,680 because this is not super intuitive. 54 00:02:32,680 --> 00:02:38,500 So let's first turn on our toolbar. Here we go. 55 00:02:38,500 --> 00:02:42,200 So you can go into a cell here and you can change 56 00:02:42,200 --> 00:02:46,200 this text, "Changed", and you can rerun it, and you can just click 'Run', 57 00:02:46,290 --> 00:02:49,190 and it will rerun your code for you, which is really nice. 58 00:02:49,200 --> 00:02:51,560 You can actually go back and do this over and over and over 59 00:02:51,570 --> 00:02:54,820 again. Let's go ahead and turn on our line numbers here. 60 00:02:54,830 --> 00:02:57,100 So in this cell, we've got line number 1, just says 'print( 61 00:02:57,250 --> 00:02:59,640 "Hello World Changed!")'. Down the road 62 00:02:59,650 --> 00:03:03,750 you're going to see me use something called 'Markdown', and 63 00:03:03,760 --> 00:03:05,100 it will just say, "Hello 64 00:03:05,100 --> 00:03:10,100 This is a title", and there's actually no code to execute, it's just 'Markdown'. 65 00:03:10,170 --> 00:03:11,510 So that is a 'Markdown' cell. 66 00:03:11,570 --> 00:03:13,970 Usually we're going to stick with regular code cells. 67 00:03:14,180 --> 00:03:17,660 There's also a bunch of shortcuts here, which if you are 68 00:03:17,670 --> 00:03:21,570 a shortcut Ninja, you probably want to learn most of these 69 00:03:21,580 --> 00:03:24,060 because there's some nice shortcuts in here, like how to 70 00:03:24,070 --> 00:03:26,610 delete a cell, how to move up and down a cell, things like 71 00:03:26,620 --> 00:03:28,200 that. For the most part 72 00:03:28,210 --> 00:03:30,360 we actually don't need to know a lot of that in this course, 73 00:03:30,370 --> 00:03:32,940 because we're just going to be using these cells to really 74 00:03:33,000 --> 00:03:34,100 explore Python. 75 00:03:34,120 --> 00:03:38,830 So let's go ahead, change that and rerun it. 76 00:03:38,840 --> 00:03:41,380 Now, I'm going to save this file, and you can save your file 77 00:03:41,380 --> 00:03:44,600 as well, by going to 'File', and this is all just done in the browser. 78 00:03:44,630 --> 00:03:47,380 So this is not actually in my browser's file settings, 79 00:03:47,380 --> 00:03:50,500 this is in what looks like a website's browser settings. 80 00:03:51,020 --> 00:03:57,650 So I go to 'File', 'Save as', and let's just call this 'first_notebook'. 81 00:03:57,650 --> 00:04:02,090 Now, I'm actually not going to make this publicly accessible 82 00:04:02,100 --> 00:04:05,050 because this one is just, I'm going to throw this file away, it's not 83 00:04:05,060 --> 00:04:07,840 useful for anything, but this is how you actually save one. 84 00:04:07,850 --> 00:04:09,250 So this is the folder that I'm in. 85 00:04:09,300 --> 00:04:15,000 I'm just going to call it 'first-notebook.ipynb'. 'Save', 86 00:04:15,700 --> 00:04:17,720 and just like that, it's saved. 87 00:04:19,100 --> 00:04:20,300 It doesn't look like it did anything. 88 00:04:20,310 --> 00:04:22,339 And then you could change the title up here if I wanted to. 89 00:04:22,350 --> 00:04:25,670 But whenever you see some of my code, and I'll show you 90 00:04:25,680 --> 00:04:28,750 where to download all of my code down the road, you want 91 00:04:28,750 --> 00:04:31,300 to do 'File', 'Open', and then you can open, 92 00:04:32,800 --> 00:04:36,600 let's say 'first-notebook.ipynb', and you can see all 93 00:04:36,700 --> 00:04:39,300 of my code and execute all of my code as well. 94 00:04:40,300 --> 00:04:42,900 Now, last but not least, sometimes you want to run something 95 00:04:42,900 --> 00:04:45,500 from the command line, this is not your command line program, 96 00:04:45,570 --> 00:04:47,470 this is simply Python, 97 00:04:47,480 --> 00:04:48,730 that's all this is. 98 00:04:48,730 --> 00:04:51,490 This is a little interactive way of working with Python. 99 00:04:51,550 --> 00:04:53,980 But if you needed to run something from the command line, 100 00:04:54,080 --> 00:04:55,490 you have two options here. 101 00:04:55,500 --> 00:04:58,670 You can either open up your Terminal, I've got two open, one 102 00:04:58,670 --> 00:05:01,500 that I'm writing code on, and one for Jupyter Notebook that runs 103 00:05:01,500 --> 00:05:06,000 behind the scenes, or you can type exclamation mark, '!', 104 00:05:06,000 --> 00:05:08,400 and then whatever your command is going to be. 105 00:05:08,400 --> 00:05:11,400 So mine is going to be '!python -V', 106 00:05:11,400 --> 00:05:13,300 and that's just going to show me the version of Python that I'm 107 00:05:13,300 --> 00:05:18,800 currently using. And hit 'Shift + Enter', and it says Python 3.7.2 108 00:05:19,800 --> 00:05:22,200 Last but not least, there is a way to actually theme this. 109 00:05:22,210 --> 00:05:25,080 So if you don't like all the bright colors and the light 110 00:05:25,090 --> 00:05:28,430 Grays, you can actually theme this. In your command line 111 00:05:28,430 --> 00:05:33,100 you could do 'pip install jupyterthemes'. 112 00:05:33,500 --> 00:05:37,200 And then, yeah, see, it's installing Jupyter Themes for me. 113 00:05:37,200 --> 00:05:39,500 [no audio] 114 00:05:39,500 --> 00:05:42,500 Cool. So it did a bunch of stuff, and then you could run, 115 00:05:43,900 --> 00:05:46,200 I think it is 'jt -t', 116 00:05:46,200 --> 00:05:47,900 and then the name of the theme, something like that. 117 00:05:47,980 --> 00:05:50,580 You'll have to look into that on your own, because I'm just 118 00:05:50,580 --> 00:05:53,900 going to use this standard version just so it keeps it nice and simple. 119 00:05:53,900 --> 00:05:57,690 And as, I don't really want to bloat this course with too many things, 120 00:05:57,750 --> 00:06:00,390 but I do want to show you that you can change the theme of 121 00:06:00,400 --> 00:06:01,620 this, so it looks a little nicer. 122 00:06:01,620 --> 00:06:04,600 Maybe it looks more like your regular text editor. So you 123 00:06:04,600 --> 00:06:05,600 can do that as well. 124 00:06:05,600 --> 00:06:10,100 I think one of them is actually 'monokai', 125 00:06:10,100 --> 00:06:11,400 I have no idea how to spell that right, 126 00:06:11,480 --> 00:06:12,910 but you could do something like that. 127 00:06:12,920 --> 00:06:16,060 And then you just shutdown Notebook, and start it up again 128 00:06:16,150 --> 00:06:18,010 from scratch, and it will look different. 129 00:06:18,100 --> 00:06:22,200 Anyways, that is a Jupyter Notebook in a nutshell. 130 00:06:22,260 --> 00:06:25,770 If you want to, you can go ahead and you can explore all 131 00:06:25,780 --> 00:06:28,440 the different cells, things that you can do, the commands, 132 00:06:28,720 --> 00:06:30,820 your command palette, or all your shortcuts. 133 00:06:30,830 --> 00:06:32,020 You could search through them. 134 00:06:32,030 --> 00:06:34,660 You can create new files. You can cut text. You can move 135 00:06:34,660 --> 00:06:36,900 up and down cells. You can do all sorts of stuff in here. 136 00:06:36,900 --> 00:06:39,100 So for the good majority of this course, we're going to be 137 00:06:39,100 --> 00:06:40,400 using a Jupyter Notebook. 138 00:06:40,580 --> 00:06:43,610 And when it comes to learning Python, I would highly recommend 139 00:06:43,620 --> 00:06:47,270 downloading Jupyter or Anaconda, and using Jupyter Notebook 140 00:06:47,460 --> 00:06:49,320 just so you can learn and tinker with Python. 141 00:06:49,330 --> 00:06:51,180 You don't have to worry about retyping anything. 142 00:06:51,190 --> 00:06:53,520 You can always just come back and you can undo something, 143 00:06:53,700 --> 00:06:55,500 rerun this out with 'Shift + Enter'. 144 00:06:56,500 --> 00:06:58,100 I wanted to get rid of it, 145 00:06:58,300 --> 00:06:59,650 get rid of that one, 146 00:06:59,660 --> 00:07:02,350 get rid of that one, get rid of that one. 147 00:07:02,500 --> 00:07:04,570 So I just deleted cells using a shortcut. 148 00:07:04,690 --> 00:07:05,650 So no big deal. 149 00:07:05,650 --> 00:07:08,140 And again, if you ever wanted to change it again, 150 00:07:08,150 --> 00:07:11,350 if you ever wanted to change something, it will just automatically 151 00:07:11,350 --> 00:07:13,510 run for you. It's very, very nice tool to have. 152 00:07:13,520 --> 00:07:16,690 You don't have to worry about retyping anything, so definitely, 153 00:07:16,700 --> 00:07:18,250 definitely get Jupyter Notebook. 154 00:07:18,250 --> 00:07:19,200 It's completely free. 155 00:07:19,200 --> 00:07:22,900 But if you don't want to, you can always just use the standard 156 00:07:23,340 --> 00:07:24,870 Python interactive shell. 157 00:07:24,870 --> 00:07:26,033 [no audio]