1 00:00:00,790 --> 00:00:03,260 Hey, you're still sticking around. 2 00:00:03,280 --> 00:00:09,040 That's good, I didn't bore you with all my talking, but yes, in this video, finally, we're going 3 00:00:09,040 --> 00:00:11,290 to write some python code. 4 00:00:11,470 --> 00:00:12,190 Holy moly. 5 00:00:12,190 --> 00:00:12,610 Thank God. 6 00:00:12,610 --> 00:00:14,050 I thought that was going to last forever. 7 00:00:14,890 --> 00:00:15,400 All right. 8 00:00:15,700 --> 00:00:18,430 So what is our first program going to do? 9 00:00:19,120 --> 00:00:26,980 Well, let's create a very, very simple function and probably the first thing any programmer learns 10 00:00:26,980 --> 00:00:29,890 to do to print our own name. 11 00:00:30,040 --> 00:00:37,820 So in here, once you have your Reppel got it set up or remember, you can also use glottal IO. 12 00:00:39,030 --> 00:00:41,130 We're simply going to write, print. 13 00:00:42,190 --> 00:00:48,130 And then you see over here that it gives us some information, but all we want to do is write Brackett's 14 00:00:49,150 --> 00:00:50,290 a quote. 15 00:00:51,440 --> 00:00:56,450 So you can do double quotes here or a single quote and just type your name. 16 00:00:59,410 --> 00:01:01,000 And if we click, Ron. 17 00:01:02,400 --> 00:01:11,910 On the right side, we've just ridden our very first Python program, very exciting, but what's happening 18 00:01:11,910 --> 00:01:12,090 here? 19 00:01:12,510 --> 00:01:14,370 Well, let's let's look at everything. 20 00:01:14,730 --> 00:01:22,200 First of all, if you're confused why my thing is dark and yours might be light, it's because if I 21 00:01:22,200 --> 00:01:27,390 go to settings, I've set my theme to light or to dark. 22 00:01:27,420 --> 00:01:28,650 I prefer the dark version. 23 00:01:28,920 --> 00:01:31,070 But you can change some of your settings. 24 00:01:31,080 --> 00:01:36,630 You can change the font size if you want, based on when you watch the video, this website, the lock 25 00:01:36,630 --> 00:01:39,510 might be different, but most of the settings should be the same. 26 00:01:40,540 --> 00:01:50,590 We see that we have a main dot pi, which is the python extension, any file that has a dot pi or PI 27 00:01:50,890 --> 00:01:52,240 is a python file. 28 00:01:52,720 --> 00:01:57,070 So what we've just written here on line one is. 29 00:01:57,950 --> 00:02:06,170 A program that prints in this case Andre Nagui or in your case, your own name, and we've run it to 30 00:02:06,170 --> 00:02:12,800 this file now, Reppel, that it takes this file already has this interpreter. 31 00:02:13,690 --> 00:02:23,080 For us, it runs this piece of code, gives this source code of may not apply to the interpreter and 32 00:02:23,080 --> 00:02:25,380 runs it right here on our right side. 33 00:02:26,110 --> 00:02:30,400 If you look over here, we're using Python version three point six point one. 34 00:02:30,850 --> 00:02:35,980 And down below we see that we have Andre Nagui printed. 35 00:02:38,690 --> 00:02:41,180 So this is our code running. 36 00:02:42,180 --> 00:02:50,460 Remember this diagram, all we've done is we have our main DCPI where we wrote print Andre Nagui, we 37 00:02:50,460 --> 00:02:55,130 gave it to the interpreter that the Reppel already provides for us. 38 00:02:55,500 --> 00:03:00,000 That interpreter takes our code, converts it into bytecode. 39 00:03:01,100 --> 00:03:08,060 And here, I'll say Andre Nagui, and then it runs it in the C Python VM, which was on the right side 40 00:03:08,060 --> 00:03:14,570 that we saw, and it finally prints our name because it tells the machine, hey, we want that text 41 00:03:14,570 --> 00:03:15,040 printed. 42 00:03:15,560 --> 00:03:17,140 So that's what we're seeing here. 43 00:03:17,330 --> 00:03:23,480 This is the C Python virtual machine essentially running this code and telling this machine, hey, 44 00:03:23,840 --> 00:03:24,950 I want you to print this. 45 00:03:25,960 --> 00:03:31,690 All right, but this is a very exciting I mean, let's let's make this program a little bit more dynamic 46 00:03:31,690 --> 00:03:35,400 for our first program, we want to do something more impressive than just print name. 47 00:03:36,280 --> 00:03:43,120 So I'm going to teach you another thing we can do in Python, and it's called input. 48 00:03:44,500 --> 00:03:52,660 Now, in here, I can say input, and you see that report actually gives me some information saying 49 00:03:52,660 --> 00:03:57,580 that I have this, you can just click here and this input over here. 50 00:03:58,500 --> 00:04:05,070 Well, what can we do, this input is going to prompt a user, and if I hover over it, you can see 51 00:04:05,550 --> 00:04:11,820 how it's giving me some information, but input simply gives us a way to capture information. 52 00:04:11,850 --> 00:04:15,050 So let's say, what is your name? 53 00:04:17,010 --> 00:04:18,630 And if I run this code. 54 00:04:20,460 --> 00:04:28,050 We see that we have our Python code running and it's asking me what is my name with this cursor here 55 00:04:28,230 --> 00:04:30,690 so I can actually type something here, I can say. 56 00:04:33,610 --> 00:04:39,370 And if I hit enter, well, there you go, I've just. 57 00:04:40,230 --> 00:04:47,400 Typed in my own name, nothing that exciting, right, but this is where code becomes interesting because 58 00:04:47,700 --> 00:04:50,520 we can store this information on our computer. 59 00:04:51,410 --> 00:04:58,130 So, again, these are things that we're going to go over in detail in our Basics Python section, but 60 00:04:58,130 --> 00:05:03,560 just to write our first code, let's assign this to memory. 61 00:05:03,770 --> 00:05:10,070 That is let's say that name equals whatever is the input of what is your name? 62 00:05:11,770 --> 00:05:14,410 And then finally, we can just print. 63 00:05:17,950 --> 00:05:20,800 So remember, the interpreter is going to take this first line. 64 00:05:21,830 --> 00:05:24,230 It's going to ask, what is your name? 65 00:05:24,650 --> 00:05:30,860 I'm going to type something, that type of information is going to get assigned to a name. 66 00:05:31,610 --> 00:05:34,570 And then finally we print name. 67 00:05:35,420 --> 00:05:41,870 Remember, an interpreter takes Line-by-line Convert's code to bytecode and then finally runs it. 68 00:05:42,890 --> 00:05:44,180 So let's give this a try. 69 00:05:44,210 --> 00:05:45,200 I'm going to click run. 70 00:05:46,740 --> 00:05:47,670 All right, what's your name? 71 00:05:48,480 --> 00:05:50,010 My name is Andre. 72 00:05:53,980 --> 00:05:59,680 I typed in my name hit Enter, and then it printed out Andre. 73 00:06:00,960 --> 00:06:07,050 So for the final feat, let's greet so we're going to say print. 74 00:06:08,730 --> 00:06:10,080 Hello. 75 00:06:12,350 --> 00:06:13,800 And then plus name. 76 00:06:14,630 --> 00:06:19,910 Now, don't worry about the syntax, we're going to go over it, but all we're doing is saying hello 77 00:06:20,120 --> 00:06:24,620 and then adding our name to the end of this. 78 00:06:25,650 --> 00:06:29,580 So let's see what happens if I run this and say, what is your name? 79 00:06:30,090 --> 00:06:32,670 My name is Andre and I hit Enter. 80 00:06:33,870 --> 00:06:39,780 I get hello, Andre, but no spaces, so let's add a little space hit run again. 81 00:06:41,200 --> 00:06:45,730 For the fourth time, my name is Andre and says, Hello, Andre. 82 00:06:46,710 --> 00:06:49,790 There it is, our first Python program. 83 00:06:50,520 --> 00:06:56,280 Now, it's not very exciting because it is our first program, we're just learning the steps here. 84 00:06:56,550 --> 00:07:04,560 But I hope because we've covered some of these topics ahead of time, that this isn't just pure magic. 85 00:07:04,710 --> 00:07:05,120 Right. 86 00:07:05,490 --> 00:07:07,880 You understand that this is source code. 87 00:07:08,130 --> 00:07:18,390 This is main DCPI that we give to an interpreter that runs our code line by line and then executes our 88 00:07:18,390 --> 00:07:22,890 program in this case are what is your name program? 89 00:07:24,060 --> 00:07:26,160 How cool is that? 90 00:07:27,080 --> 00:07:33,110 This is just the beginning where we're going to get more and more advanced here, see if he can play 91 00:07:33,110 --> 00:07:38,120 around with this, we don't know that much about Python yet, but I hope this gets you excited because, 92 00:07:38,120 --> 00:07:40,270 well, there's a lot more coding coming along. 93 00:07:40,730 --> 00:07:41,680 I'll see in the next one. 94 00:07:42,290 --> 00:07:42,650 Bye bye.